From: Paul Mackerras <paulus@samba.org>
To: "Christopher Friesen" <cfriesen@nortelnetworks.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: problem accessing /dev/port
Date: Fri, 23 Nov 2001 14:55:29 +1100 (EST) [thread overview]
Message-ID: <15357.51377.732840.867724@cargo.ozlabs.ibm.com> (raw)
In-Reply-To: <3BFD769A.376003D5@nortelnetworks.com>
In-Reply-To: <3BFD769A.376003D5@nortelnetworks.com>
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.
prev parent reply other threads:[~2001-11-23 4:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-22 22:05 Christopher Friesen
2001-11-23 3:55 ` Paul Mackerras [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15357.51377.732840.867724@cargo.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=cfriesen@nortelnetworks.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®