* Directly accessing I/O ports
@ 2002-07-19 0:06 Greg Allen
2002-07-20 18:10 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Greg Allen @ 2002-07-19 0:06 UTC (permalink / raw)
To: linuxppc-dev
I'd like to get the Linux ethernet card diagnostic tool,
eepro100-diag.c (from http://www.scyld.com/diag/index.html) running
on the PowerPC.
Unfortunately, it uses iopl() and inw()/outw()/inl()/outl() to access
the entire I/O port space directly in userland. In fact, much of this
family of utils does the same thing.
I tried something like:
io_fd = open("/dev/port", O_RDWR);
iobase = mmap(0, device_size, PROT_READ|PROT_WRITE, MAP_SHARED,
io_fd, device_base);
but I can't get it to work.
Are there suggestions (or code snippets) as to how I should proceed?
For that matter, what's the *right* way to access this sort of thing
from userland?
Thanks,
-Greg
--
Gregory E. Allen, MSEE Engineering Scientist
Applied Research Laboratories: The University of Texas at Austin
Please help find my missing daughter: http://FindSabrina.org/
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Directly accessing I/O ports
2002-07-19 0:06 Directly accessing I/O ports Greg Allen
@ 2002-07-20 18:10 ` Benjamin Herrenschmidt
2002-07-22 17:00 ` Tom Rini
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2002-07-20 18:10 UTC (permalink / raw)
To: Greg Allen, linuxppc-dev
>For that matter, what's the *right* way to access this sort of thing
>from userland?
mmap /proc/bus/pci with proper flags. By defaults it's PIO,
but you can use ioctl after the open() call and before the mmap()
call to set the requested mapping type to MMIO, PIO, ...
The code handling this is in drivers/pci/proc.c
The important point is that on PPC, the PIO space isn't limited
to one 64k space like on x86, but is a full set of separate address
spaces (one per host PCI bus).
Ben.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Directly accessing I/O ports
2002-07-20 18:10 ` Benjamin Herrenschmidt
@ 2002-07-22 17:00 ` Tom Rini
0 siblings, 0 replies; 3+ messages in thread
From: Tom Rini @ 2002-07-22 17:00 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Greg Allen, linuxppc-dev
On Sat, Jul 20, 2002 at 08:10:58PM +0200, Benjamin Herrenschmidt wrote:
>
> >For that matter, what's the *right* way to access this sort of thing
> >from userland?
[snip]
Or the other fix, which iirc Jeff Garzik has somewhere on his todo list
is to make it work with ethtool ioctls.
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-07-22 17:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-19 0:06 Directly accessing I/O ports Greg Allen
2002-07-20 18:10 ` Benjamin Herrenschmidt
2002-07-22 17:00 ` Tom Rini
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).