Subject: Re: Slightly off-topic: Anyone know OpenBoot cmds for PCI access
To: Thomas Pornin <pornin@bolet.org>
From: Eduardo Horvath <eeh@NetBSD.org>
List: port-sparc
Date: 05/19/2004 15:42:20
On Wed, May 19, 2004 at 09:07:08AM +0200, Thomas Pornin wrote:
> On Tue, May 18, 2004 at 11:54:47AM -0400, Steven Grunza wrote:
> > How do I read from a "pointer" in Forth? In C I would simply do the
> > following:
> >
> > volatile long unsigned int *ptr;
> > volatile long unsigned int value;
> >
> > ptr = (long unsigned int *) 0x114024;
> > value = *ptr;
> >
> > printf(" The value is %#x\n", value);
>
> The Forth word for dereferencing is "@". Therefore, the following may
> work:
>
> hex 114024 @ u.
>
> "hex" means: numeric constants shall henceforth be parsed in hexadecimal.
> "114024" pushes the address on the stack.
> "@" pops the address and pushes the value which lies at that address.
> "u." pops a value, and prints it as an unsigned integer (in hexadecimal,
> thanks to the previous "hex" word).
It's not necessarily that simple. Device accesses may require cache flushes
or invalidations, endianness swapping, address twiddling, etc.
Go to docs.sun.com and hunt down the _OpenBoot 3.x Supplement for PCI_. It
should describe exactly what you need to properly access device registers
over a PCI bus.
Eduardo