[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help with some low level access



On Mon, 3 Feb 2003, vinai wrote:
> I'm not anywhere near an expert on this, so take what I say with a pound
> of salt or so ... :)  I was reading up on the PCI specifications to try
> to understand a little bit about drivers, and it was mentioned that the
> x86 architecture use I/O space to access devices, whereas with PowerPC
> systems, everything is accessed through memory space mapping ...

So you should mmap() /dev/mem and access the memory range that contains PCI I/O
space on your box. This is machine dependent. An example (for CHRP LongTrail)
can be found at http://home.tvd.be/cr26864/Linux/PPC/sio.c

In theory we could let ioperm() take care of mapping /dev/mem and setting up
_IO_BASE, based on information from /proc.

> On Tue, 4 Feb 2003, Ross Vumbaca wrote:
> > I'm was trying to "debug" a problem with a driver and my PowerPC board,
> > and I wrote this simple program which works fine on an x86 Debian Woody
> > box (and does not use x86 dependent functions as far as I can tell):
> >
> > #include <stdio.h>
> > #include <sys/io.h>
> >
> > int main() {
> >          ioperm(0x00, 0xff, 1);
> >          printf ("Status register: %x\n", inb(0x08));
> >          return 0;
> > }
> >
> > It seems that sys/io does not exist (using Debian Woody/PowerPC).
> > I've searched around, but I can't find ioperm here, or inb even (except
> > in the kernel), Probably this is a really dumb question, I'm a newbie to
> > this - can anyone tell me what I'm doing wrong, or if I'm doing
> > something really dumb.. (Is it possible even to use something like that
> > on PowerPC? It works on the x86)..

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



Reply to: