public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* problem accessing /dev/port
@ 2001-11-22 22:05 Christopher Friesen
  2001-11-23  3:55 ` Paul Mackerras
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Friesen @ 2001-11-22 22:05 UTC (permalink / raw)
  To: linux-kernel


To begin, I'm running 2.2.17 with some patches.

I'm attempting to have a userspace app read and write I/O ports on a powerpc
machine.  The obvious method (iopl()) doesn't seem to be available (using glibc,
but sys/io.h doesn't exist).

When I try and access /dev/port with a small utility that works fine on my PIII,
I get the error message "Device not configured".  The file exists in /dev and
has the same permissions on both machines.

Do I need to enable something in the kernel to support this?  Where is this
configured?

Thanks,

Chris

-- 
Chris Friesen                    | MailStop: 043/33/F10  
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: problem accessing /dev/port
  2001-11-22 22:05 problem accessing /dev/port Christopher Friesen
@ 2001-11-23  3:55 ` Paul Mackerras
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mackerras @ 2001-11-23  3:55 UTC (permalink / raw)
  To: Christopher Friesen; +Cc: linux-kernel

Christopher Friesen writes:

> To begin, I'm running 2.2.17 with some patches.
> 
> I'm attempting to have a userspace app read and write I/O ports on a powerpc
> machine.  The obvious method (iopl()) doesn't seem to be available (using glibc,
> but sys/io.h doesn't exist).
> 
> When I try and access /dev/port with a small utility that works fine on my PIII,
> I get the error message "Device not configured".  The file exists in /dev and
> has the same permissions on both machines.

If you look in drivers/char/mem.c you will see an #if that eliminates
the statement filp->f_op = &port_fops if CONFIG_PPC is defined.  The
reason for this is that accessing a non-existent I/O port on powermacs
generates a machine check interrupt which, in 2.2.x kernels, causes a
panic.  The situation is better in 2.4 because we catch the machine
check and arrange for inb/w/l to return ~0.

> Do I need to enable something in the kernel to support this?  Where is this
> configured?

Change the #if line to take out the defined(CONFIG_PPC) part.

The other way to access I/O from userspace is to mmap /dev/mem at the
offset that corresponds to the physical address where your PCI host
bridge maps PCI I/O space, e.g. you would use an offset of 0xfe000000
for an MPC106 (grackle) bridge.  Once again the situation is better in
2.4 since you can mmap the /proc/bus/pci/bb/dd.f file corresponding to
your pci device and access its memory and I/O regions that way.

Paul.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-11-23  4:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-22 22:05 problem accessing /dev/port Christopher Friesen
2001-11-23  3:55 ` Paul Mackerras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox