<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Dec 28, 2017, at 9:56 AM, Programmingkid <<a href="mailto:programmingkidx@gmail.com" class="">programmingkidx@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Dec 28, 2017, at 9:36 AM, Jd Lyons <<a href="mailto:lyons_dj@yahoo.com" class="">lyons_dj@yahoo.com</a>> wrote:<br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">On Dec 27, 2017, at 5:02 PM, Programmingkid <<a href="mailto:programmingkidx@gmail.com" class="">programmingkidx@gmail.com</a>> wrote:<br class=""><br class=""><blockquote type="cite" class=""><br class="">On Dec 21, 2017, at 6:51 PM, BALATON Zoltan <<a href="mailto:balaton@eik.bme.hu" class="">balaton@eik.bme.hu</a>> wrote:<br class=""><br class="">On Thu, 21 Dec 2017, Programmingkid wrote:<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">On Dec 21, 2017, at 12:56 PM, BALATON Zoltan <<a href="mailto:balaton@eik.bme.hu" class="">balaton@eik.bme.hu</a>> wrote:<br class="">On Thu, 21 Dec 2017, Jd Lyons wrote:<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">On Dec 21, 2017, at 9:59 AM, Programmingkid <<a href="mailto:programmingkidx@gmail.com" class="">programmingkidx@gmail.com</a>> wrote:<br class=""><blockquote type="cite" class="">On Dec 21, 2017, at 9:36 AM, Jd Lyons <<a href="mailto:lyons_dj@yahoo.com" class="">lyons_dj@yahoo.com</a>> wrote:<br class="">I don’t know, this maybe an issue with the way we have defined “us”.<br class=""></blockquote></blockquote></blockquote><br class="">I'm not sure the us word is related to problems with b?branch but I don't know anything about this other than reading the conversation here. They look unrelated to me but it could well be I did not undersand this at all.<br class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">Looking through the SLOF code it seems they call it like this in the timebase.fs:<br class="">: tb@  ( -- tb )<br class="">BEGIN tbu@ tbl@ tbu@ rot over <> WHILE 2drop REPEAT<br class="">20 lshift swap ffffffff and or<br class="">;<br class="">: milliseconds ( -- ms ) tb@ d# 1000 * tb-frequency / ;<br class="">: microseconds ( -- us ) tb@ d# 1000000 * tb-frequency / ;<br class="">: ms ( ms-to-wait -- ) milliseconds + BEGIN milliseconds over >= UNTIL drop ;<br class="">: get-msecs ( -- n ) milliseconds ;<br class="">: us  ( us-to-wait -- )  microseconds +  BEGIN microseconds over >= UNTIL  drop ;<br class="">Not sure if I can port/hack this code over, the copier seems to have trouble with tbu@ tbl@?<br class=""></blockquote>The ms and get-msecs words don't appear to be implemented correctly on OpenBIOS. 10000 ms should pause OpenBIOS for 10 seconds. It does not.<br class="">I did find a function called udelay() in the drivers/timer.c file. Maybe I can implement the word us using udelay(). Then the ms word could be implemented using the us word.<br class=""></blockquote><br class="">See what you can do about : us, but we maybe running into an issue with Qemu/mac99. Every version of the Mac OS reports a different bus and cpu speed, so we maybe having trouble with the way the timebase is calculated in Qemu.<br class=""></blockquote><br class="">I think you have two choices for this:<br class=""><br class="">1. Either export udelay (or _wait_ticks it's based on) to Forth and implement these words based on that. But this comment in drivers/timer.c:<br class=""></blockquote><br class="">How would I do this?<br class=""><br class=""><blockquote type="cite" class="">/*<br class="">* TODO: pass via lb table<br class="">*/<br class="">unsigned long timer_freq = 10000000 / 4;<br class=""><br class="">suggests you may need to fix this first to take into accound the actual TB frequency from the CPU instead of some hardcoded value.<br class=""></blockquote><br class="">This would make a good next step.<br class=""><br class=""><blockquote type="cite" class=""><br class="">2. Alternatively, you could either add new helpers (maybe in arch/ppc/timebase.S) to implement tbl@ and tbu@ which probably should just do mftb and mftbu respectively or export to Forth the already existing _get_ticks which returns these as a combined 64 bit value and derive the lower and upper 32 bits from Forth and then maybe you can use the above implementation from SLOF.<br class=""></blockquote><br class="">It is a possibility.<br class=""><br class="">We still need a way to access any new C function from forth. The only thing that I think would work is implementing the us word in a device node, then make another definition of us that is available to the dictionary. If anyone has a way to do this, an example would be great.<br class=""></blockquote><br class="">I don't know much about this but looking at the code I think _get_ticks is almost equivalent to tb@ above except that _get_ticks returns tbu@ in %r3 and tbl@ in %r4 but tb@ also combines these into one value. Then you can see e.g. in arch/ppc/qemu/init.c that the bind_func() function is used to make C functions available from Forth. So you could make a C function which calls _get_ticks then combines %r3 and %r4 into a 64bit value (so implements what tb@ does in C) then bind this to tb@. Or bind _get_ticks and implement tb@ calling this and combining the upper and lower values from Forth like above (I think this is what '20 lshift swap ffffffff and or' does but I don't know Forth to tell).<br class=""><br class="">You'll also need tb-frequency which can be found in the cpu properties (added in arch/ppc/qemu/init.c by reading the correct value from QEMU). SLOF has a function that seems to be called during init but I can't read Forth enough to tell for sure what it actually does:<br class=""><br class="">\ Fixup timebase frequency from device-tree<br class="">: fixup-tbfreq<br class=""> " /cpus/@0" find-device<br class=""> " timebase-frequency" get-node get-package-property IF<br class="">     2drop<br class=""> ELSE<br class="">     decode-int to tb-frequency 2drop<br class=""> THEN<br class=""> device-end<br class="">;<br class="">fixup-tbfreq<br class=""><br class="">But I think this is what sets tb-frequency global value so you'll probably need something similar somewhere (maybe ppc.fs). Then you have tb@ and tb-frequency so the rest should work.<br class=""><br class="">Now it's your turn to find out how to do this in OpenBIOS.<br class=""><br class="">Regards,<br class="">BALATON Zoltan<br class=""></blockquote><br class="">This code can be directly pasted into OpenBIOS:<br class=""><br class="">0 value tb-frequency<br class=""><br class="">\ Fixup timebase frequency from device-tree<br class="">: fixup-tbfreq<br class=""> " /cpus/@0" find-device<br class=""> " timebase-frequency" active-package get-package-property IF<br class="">     2drop<br class=""> ELSE<br class="">     decode-int to tb-frequency 2drop<br class=""> THEN<br class=""> device-end<br class="">;<br class="">fixup-tbfreq<br class=""><br class=""></blockquote><br class="">I applied your patch, and used this code in Openbios, then booted the Mac OS to see if it reported the correct Bus Frequency, but it still reporting 400mhz bus speed.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">How do you define "correct bus frequency"?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">From what I remember Mac OS only supports certain bus frequencies. Well I'm not sure if it was bus or CPU frequencies that I am thinking about.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div>Seems to be just the ASP getting the Bus Frequency wrong, for mac99. It reposts it correct for g3beige, and skidmarks GT reports the correct Timebase for each. Mac99 isn’t really any one machine, so I’t no wonder we have these odd quirks.</div><div><br class=""></div><div>Are you trying to get the correct timing for the ms and us words, was that part of the point of your patch? </div><br class=""><blockquote type="cite" class=""><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">Not really sure what this code should do, but, I’m not sure you are aware, qemu's new_world.c and the old_world.c also set the timebase for mac99 and g3biege.<br class=""><br class="">Thanks for putting in this work.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">You are welcome. I'm glad to help.<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><br class="">Now that tbl@, tbu@, and tb-frequency are done, the code from SLOF will probably work in OpenBIOS.<br class="">--<span class="Apple-converted-space"> </span><br class="">OpenBIOS                 <a href="http://openbios.org/" class="">http://openbios.org/</a><br class="">Mailinglist:  <a href="http://lists.openbios.org/mailman/listinfo" class="">http://lists.openbios.org/mailman/listinfo</a><br class="">Free your System - May the Forth be with you<br class=""></blockquote><br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">--<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">OpenBIOS                 </span><a href="http://openbios.org/" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">http://openbios.org/</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Mailinglist:  </span><a href="http://lists.openbios.org/mailman/listinfo" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">http://lists.openbios.org/mailman/listinfo</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Free your System - May the Forth be with you</span></div></blockquote></div><br class=""></body></html>