* asm in OF?
@ 2000-08-29 17:37 Michel Lanners
2000-08-29 19:24 ` Geert Uytterhoeven
2000-08-30 9:48 ` Gabriel Paubert
0 siblings, 2 replies; 6+ messages in thread
From: Michel Lanners @ 2000-08-29 17:37 UTC (permalink / raw)
To: linuxppc-dev
Hi all,
Does anybody know how to embed machine code into an OF script (into
nvramrc, that is)? I suppose OF doesn't have an assembler built-in, so
machine code would be the only option.
For the curious, what I'm trying to do is get my box (7600 upgraded with
G3/300) to boot again from my IBM disk on the MESH SCSI bus. Right now,
it does that only if I run the G3 below 200 MHz, or the bus speed around
40 MHz. Anything faster, and I can't access that disk on the MESH bus.
The external (53c96) is o, however... but much slower.
So, I wanted to check whether using the L1 cache throttling mechanism to
slow down the CPU during boot would help anything... I can then release
the brake later, once Linux is up (which doesn't have any problem with
the MESH).
To use the cache throttling, I need to access the ICTC register, but
there is no OF method to do that. So I would have to code one myself...
Since it seems the OF MESH driver is at fault, I could try to patch that
one, but that seems like an even harder task...
I could also try and copy other special register access methods (like
hid0@ and hid0!) if I knew how...
Thanks for any hints you can provide!
Michel
-------------------------------------------------------------------------
Michel Lanners | " Read Philosophy. Study Art.
23, Rue Paul Henkes | Ask Questions. Make Mistakes.
L-1710 Luxembourg |
email mlan@cpu.lu |
http://www.cpu.lu/~mlan | Learn Always. "
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: asm in OF?
2000-08-29 17:37 Michel Lanners
@ 2000-08-29 19:24 ` Geert Uytterhoeven
2000-08-30 9:48 ` Gabriel Paubert
1 sibling, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2000-08-29 19:24 UTC (permalink / raw)
To: Michel Lanners; +Cc: linuxppc-dev
On Tue, 29 Aug 2000, Michel Lanners wrote:
> Does anybody know how to embed machine code into an OF script (into
> nvramrc, that is)? I suppose OF doesn't have an assembler built-in, so
> machine code would be the only option.
I think it does, since e.g. `see rb@' tells me
| code rb@
| ff83b474 lbz r28,0(r28)
| ff83b478 bcctr always
But then I'm the one with the real Firmworks Open Firmware, and not some Apple
surrogate...
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: asm in OF?
[not found] <20000829180430.22619@mailhost.mipsys.com>
@ 2000-08-29 22:43 ` Michel Lanners
0 siblings, 0 replies; 6+ messages in thread
From: Michel Lanners @ 2000-08-29 22:43 UTC (permalink / raw)
To: bh40; +Cc: linuxppc-dev
Bonsoir Ben,
On 29 Aug, this message from Benjamin Herrenschmidt echoed through cyberspace:
> It may be cache throttling, but it may also be the speculative prefetch
> or the lack of the guard bit on the IO pages (this ROM doesn't set the
> correctly).
I don't know for sure what the problem is; some tech guy from Metabox
(maker of the G3 upgrade card) talked about '... busy loop in
software...', but gave no details. Therefore I suppose that something in
the MESH SCSI driver breaks if the CPU runs too fast. Which would
explain why it works OK if I reduce CPU and/or bus speed.
And that is the reason I want to try to throttle the CPU via ICTC :-)
> So you have to play with ICTC and HID0.
I've been able to have a look at OF's implementation of the hid0! and
hid0@ commands (address is bogus... it's pasted into a kernel file ;-)):
hid0@:
c0000010: 96 9f ff fc stwu r20,-4(r31)
c0000014: 7e 90 fa a6 mfdbsr r20
c0000018: 4e 80 00 20 blr
hid0!:
c0000020: 7e 90 fb a6 mtdbsr r20
c0000024: 4c 00 01 2c isync
c0000028: 82 9f 00 00 lwz r20,0(r31)
c000002c: 3b ff 00 04 addi r31,r31,4
c0000030: 4e 80 00 20 blr
Obviously, the convention in OF is that r20 contains the top stack
value, and r31 the stack pointer. So, I know what my asm needs to look
like; I only need to find out how to code that in forth...
Somewhere in my doc archive, I've found a book by FirmWorks titled
'Writing FCode Programs for PCI - An Introduction to FCode Programming
Fully Compliant with IEEE Standard 1275-1994'. It doesn't talk a lot
about asm coding... but is perfect if you want to write a new FCode
driver for some strange hardware!
It looks as if I could code my ictc@ and ictc! commands two ways:
Either create an array in memory, that gets executed later:
// am I missing some end delimiter here?
create ictc@ <code> l, <code> l, <code> l,
code ictc@ // executes my code defined above
or define a new word with code:
// code definition in compile mode
] code ictc@ <code> l, <code> l, <code> l, c; [
code ictc@ // execute above code
This second method doesn't seemto work; but I may be missing the right
way to provide the name string for the new word...
OK, enough hacking; time for bed ;-)
Michel (falling asleep)
-------------------------------------------------------------------------
Michel Lanners | " Read Philosophy. Study Art.
23, Rue Paul Henkes | Ask Questions. Make Mistakes.
L-1710 Luxembourg |
email mlan@cpu.lu |
http://www.cpu.lu/~mlan | Learn Always. "
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: asm in OF?
2000-08-29 17:37 Michel Lanners
2000-08-29 19:24 ` Geert Uytterhoeven
@ 2000-08-30 9:48 ` Gabriel Paubert
2000-08-30 13:44 ` Michel Lanners
1 sibling, 1 reply; 6+ messages in thread
From: Gabriel Paubert @ 2000-08-30 9:48 UTC (permalink / raw)
To: Michel Lanners; +Cc: linuxppc-dev
On Tue, 29 Aug 2000, Michel Lanners wrote:
>
> Hi all,
>
> Does anybody know how to embed machine code into an OF script (into
> nvramrc, that is)? I suppose OF doesn't have an assembler built-in, so
> machine code would be the only option.
All the OF I have seen had the capability to build new words in asm, with
a `code' definition IIRC. Maybe Apple's OF are crippled ?
> For the curious, what I'm trying to do is get my box (7600 upgraded with
> G3/300) to boot again from my IBM disk on the MESH SCSI bus. Right now,
> it does that only if I run the G3 below 200 MHz, or the bus speed around
> 40 MHz. Anything faster, and I can't access that disk on the MESH bus.
> The external (53c96) is o, however... but much slower.
>
> So, I wanted to check whether using the L1 cache throttling mechanism to
> slow down the CPU during boot would help anything... I can then release
> the brake later, once Linux is up (which doesn't have any problem with
> the MESH).
>
> To use the cache throttling, I need to access the ICTC register, but
> there is no OF method to do that. So I would have to code one myself...
>
> Since it seems the OF MESH driver is at fault, I could try to patch that
> one, but that seems like an even harder task...
>
> I could also try and copy other special register access methods (like
> hid0@ and hid0!) if I knew how...
On one of my MVME2600 boxes (the only one which I can still switch to Open
Bug^WFirmware):
ok see hid0@
code hid0@
e49110 stwu r28,-4(r31)
e49114 mfspr r28,hid0
e49118 bcctr always
ok see hid0!
code hid0!
e4912c sync
e49130 isync
e49134 mtspr hid0,r28
e49138 isync
e4913c sync
e49140 lwz r28,0(r31)
e49144 addi r31,r31,4
e49148 bcctr always
ok
The syntax to build with an unknwown SPR is strange:
code ictc@
stwu r28,-4(r31)
33f mfspr r28,*
bcctr 20,0
generates the correct code, since I don't have ictc spr defined.
Otherwise mfspr 28,ictc might work. After this, I have:
ok see ictc@
code ictc@
edcc5c stwu r28,-4(r31)
edcc60 mfspr r28,spr1017
edcc64 bcctr always
ok
Regards,
Gabriel.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: asm in OF?
2000-08-30 9:48 ` Gabriel Paubert
@ 2000-08-30 13:44 ` Michel Lanners
2000-08-30 14:05 ` Gabriel Paubert
0 siblings, 1 reply; 6+ messages in thread
From: Michel Lanners @ 2000-08-30 13:44 UTC (permalink / raw)
To: Gabriel Paubert; +Cc: linuxppc-dev
Hi Gabriel,
> All the OF I have seen had the capability to build new words in asm, with
> a `code' definition IIRC. Maybe Apple's OF are crippled ?
Apple's OF seems to have that capability as well (I think, guess and hope ;-).
However, it does _not_ seem to have an assembler built-in. The 'code' word
is defined all right.
> On one of my MVME2600 boxes (the only one which I can still switch to Open
> Bug^WFirmware):
>
> ok see hid0@
> code hid0@
> e49110 stwu r28,-4(r31)
> e49114 mfspr r28,hid0
> e49118 bcctr always
When I do a 'see hido@', I only get:
>0 see hid0@ code hid0 ok
>0
What I can do is look at the hex dump of the hid0@ word, and that gives me asm
statements like for you (except that in Apple's OF, r20 holds the top stack
item ;-). The fact that ' ' hid0@ dis' gives me a hex dump and not a
disassembly is another evidence that Apple's OF doesn't know anything about
asm....
> ok see hid0!
> code hid0!
> e4912c sync
> e49130 isync
> e49134 mtspr hid0,r28
> e49138 isync
> e4913c sync
> e49140 lwz r28,0(r31)
> e49144 addi r31,r31,4
> e49148 bcctr always
> ok
Apple's code looks very similar....
> The syntax to build with an unknwown SPR is strange:
> code ictc@
> stwu r28,-4(r31)
> 33f mfspr r28,*
> bcctr 20,0
>
> generates the correct code, since I don't have ictc spr defined.
> Otherwise mfspr 28,ictc might work.
I will try this tonight, but I doubt I will be able to enter this as asm
words. Do you know the alternate syntax? Would something lime this work:
code 60000000 l, 6000000 l,
as a sequence of 2 NOP's? How do you terminate a 'code' sequence?
Thanks a lot
Michel
--
.sig eater at work
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: asm in OF?
2000-08-30 13:44 ` Michel Lanners
@ 2000-08-30 14:05 ` Gabriel Paubert
0 siblings, 0 replies; 6+ messages in thread
From: Gabriel Paubert @ 2000-08-30 14:05 UTC (permalink / raw)
To: Michel Lanners; +Cc: linuxppc-dev
Hi Michel,
> > All the OF I have seen had the capability to build new words in asm, with
> > a `code' definition IIRC. Maybe Apple's OF are crippled ?
>
> Apple's OF seems to have that capability as well (I think, guess and hope ;-).
> However, it does _not_ seem to have an assembler built-in. The 'code' word
> is defined all right.
You don't have any ppc-assembler vocabulary or similar, then ?
> When I do a 'see hido@', I only get:
> >0 see hid0@ code hid0 ok
> >0
Ok, how can something this close to the machine be delivered without an
assembler ?
> What I can do is look at the hex dump of the hid0@ word, and that gives me asm
> statements like for you (except that in Apple's OF, r20 holds the top stack
> item ;-). The fact that ' ' hid0@ dis' gives me a hex dump and not a
> disassembly is another evidence that Apple's OF doesn't know anything about
> asm....
Well, sincee you can type in hex, there is still some hope...
> > The syntax to build with an unknwown SPR is strange:
> > code ictc@
> > stwu r28,-4(r31)
> > 33f mfspr r28,*
> > bcctr 20,0
> >
> > generates the correct code, since I don't have ictc spr defined.
> > Otherwise mfspr 28,ictc might work.
>
> I will try this tonight, but I doubt I will be able to enter this as asm
> words. Do you know the alternate syntax? Would something lime this work:
>
> code 60000000 l, 6000000 l,
I think so, let me try:
ok code ictc@ ok 979ffffc l, 7f99faa6 l, 4e800420 l, ;code
ok see ictc@
code ictc@
edcc5c stwu r28,-4(r31)
edcc60 mfspr r28,spr1017
edcc64 bcctr always
ok ictc@ .
264d2
ok
It just works and returns garbage on a 603e, everytime a different value.
> as a sequence of 2 NOP's? How do you terminate a 'code' sequence?
Oops, forgot about it, my bad. With ';code', isn't it obvious ?
Gabriel.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2000-08-30 14:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20000829180430.22619@mailhost.mipsys.com>
2000-08-29 22:43 ` asm in OF? Michel Lanners
2000-08-29 17:37 Michel Lanners
2000-08-29 19:24 ` Geert Uytterhoeven
2000-08-30 9:48 ` Gabriel Paubert
2000-08-30 13:44 ` Michel Lanners
2000-08-30 14:05 ` Gabriel Paubert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).