* io.h and I/O port access from user space
@ 2002-02-05 20:34 Jeffrey D. Kowing
2002-02-05 21:26 ` Jeffrey D. Kowing
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Jeffrey D. Kowing @ 2002-02-05 20:34 UTC (permalink / raw)
To: linuxppc-dev
This question concerns ISA ioport access from user space and
<sys/io.h>. I know there has been several discussions on this in the
mailing lists, e.g.
http://lists.linuxppc.org/linuxppc-dev/200003/msg00076.html
By the way, when attempting to consult the FAQ,
http://penguinppc.org/projects/faq.shtml,
it seemed to be a dead link.
I was trying to compile (actually cross-compile) the isapnptools
utilities. The program accesses ISA io ports using inb/outb from user
space. When compiling, I got errors because it could not find
<sys/io.h> which, when I look on my i386 platform, defines the
inb/outb functions and is part of glibc (although cleary it is
platform dependent).
The powerpc glibc does not install this file, at least for both
yellowdog 2.1 and on the MontaVista Journeyman 2.1 distributions.
I foolishly simply linked <asm/io.h> to <sys/io.h> (I'm talking about
my powerpc system include files of course) but that does not work, if,
for no other reason, that the asm-ppc/io.h file is protected from user
space programs with #ifdef __KERNEL__.
So, I guess my questions are as follows:
Is there suppose to be a <sys/io.h> for powerpc platforms ?
What include file should I use to get inb/outb defined for a user
space program. (This is a linuxppc 2.4.x kernel I'm working with.)
I guess it is still the case for the linuxppc-2.4.x series that I need
to mmap /dev/mem first as per Geert's advice in
http://lists.linuxppc.org/linuxppc-dev/200003/msg00076.html advice?
Has anyone in powerpc land used the isapnptools ?
Thanks. I really appreciate this excellent list and all the folks
that make Linux/PPC possible!
--
Jeff Kowing
jeffrey.d.kowing1@jsc.nasa.gov
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 8+ messages in thread* io.h and I/O port access from user space
2002-02-05 20:34 io.h and I/O port access from user space Jeffrey D. Kowing
@ 2002-02-05 21:26 ` Jeffrey D. Kowing
2002-02-05 21:48 ` Hollis Blanchard
2002-02-06 10:37 ` Geert Uytterhoeven
2 siblings, 0 replies; 8+ messages in thread
From: Jeffrey D. Kowing @ 2002-02-05 21:26 UTC (permalink / raw)
To: jeffrey.d.kowing1; +Cc: linuxppc-dev
Jeffrey D. Kowing writes:
> By the way, when attempting to consult the FAQ,
> http://penguinppc.org/projects/faq.shtml,
> it seemed to be a dead link.
Oops, sorry, I meant the FAQ-O-Matic link, referenced at the top of
the linuxppc FAQ:
http://cobweb.dartmouth.edu/cgi-bin/cgiwrap/jonh/faqomatic/faq.pl
--
Jeff Kowing
jeffrey.d.kowing1@jsc.nasa.gov
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: io.h and I/O port access from user space
2002-02-05 20:34 io.h and I/O port access from user space Jeffrey D. Kowing
2002-02-05 21:26 ` Jeffrey D. Kowing
@ 2002-02-05 21:48 ` Hollis Blanchard
2002-02-05 22:17 ` Jeffrey D. Kowing
2002-02-06 10:37 ` Geert Uytterhoeven
2 siblings, 1 reply; 8+ messages in thread
From: Hollis Blanchard @ 2002-02-05 21:48 UTC (permalink / raw)
To: jeffrey.d.kowing1; +Cc: linuxppc-dev
On Tue, 2002-02-05 at 14:34, Jeffrey D. Kowing wrote:
>
> Is there suppose to be a <sys/io.h> for powerpc platforms ?
I guess not. I'm not a glibc person though...
> What include file should I use to get inb/outb defined for a user
> space program. (This is a linuxppc 2.4.x kernel I'm working with.)
I'm not sure there are any.
> I guess it is still the case for the linuxppc-2.4.x series that I need
> to mmap /dev/mem first as per Geert's advice in
> http://lists.linuxppc.org/linuxppc-dev/200003/msg00076.html advice?
Yes, you certainly need to mmap /dev/mem.
> Has anyone in powerpc land used the isapnptools ?
I guess the obvious question is do you have ISA slots in the system
you're trying to build for? And you don't want to use the in-kernel
stuff? Do you really *need* isapnptools? :)
If you have ISA, it's probably a PReP? I've done user space IO simply by
mmap'ing (offset = 0x80000000), then just doing accesses normally:
(char *)ioregion = mmap(...)
ioregion[0x3fc] = 0x1;
etc.
-Hollis
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: io.h and I/O port access from user space
2002-02-05 21:48 ` Hollis Blanchard
@ 2002-02-05 22:17 ` Jeffrey D. Kowing
2002-02-05 22:34 ` Benjamin Herrenschmidt
2002-02-05 23:07 ` Hollis Blanchard
0 siblings, 2 replies; 8+ messages in thread
From: Jeffrey D. Kowing @ 2002-02-05 22:17 UTC (permalink / raw)
To: Hollis Blanchard; +Cc: jeffrey.d.kowing1, linuxppc-dev
Hollis Blanchard writes:
> I guess the obvious question is do you have ISA slots in the system
> you're trying to build for? And you don't want to use the in-kernel
> stuff? Do you really *need* isapnptools? :)
Well, since you ask and at the risk of further demonstrating my
ignorance:
Yes, I have ISA slots - well, actually, I have a PC/104 stack.
Specifically, I've got an inhouse 603ev/MPC106 board on a PC/104 form
factor running a linuxppc 2.4.x kernel. I've been using an Adastra
NSP-104 PC/104 module as my network interface card. That card,
besides its ethernet chip, also has a Super I/O PC87338 chip that
controls two serial ports (i.e. SCC1 and SCC2). Naturally, I just had
to use those two serial ports, and, of course, it doesn't have nice
little jumpers to set IRQ and IO base addresses. Instead, it wants to
be configured using Plug-n-Play which I obviously know nothing about.
Anyways, I thought, hey, I'll investigate by using this nifty
isapnptools package. Silly me.
But beyond my specific problem, I guess it got me to wondering in
general about the proper way to write user space programs using
inb/outb (and in my wildest fantasies of submiting a patch for
isapnptools).
--
Jeff Kowing
jeffrey.d.kowing1@jsc.nasa.gov
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: io.h and I/O port access from user space
2002-02-05 22:17 ` Jeffrey D. Kowing
@ 2002-02-05 22:34 ` Benjamin Herrenschmidt
2002-02-05 23:07 ` Hollis Blanchard
1 sibling, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2002-02-05 22:34 UTC (permalink / raw)
To: jeffrey.d.kowing1, Hollis Blanchard; +Cc: jeffrey.d.kowing1, linuxppc-dev
>
>
>Well, since you ask and at the risk of further demonstrating my
>ignorance:
>
>Yes, I have ISA slots - well, actually, I have a PC/104 stack.
>
>Specifically, I've got an inhouse 603ev/MPC106 board on a PC/104 form
>factor running a linuxppc 2.4.x kernel. I've been using an Adastra
>NSP-104 PC/104 module as my network interface card. That card,
>besides its ethernet chip, also has a Super I/O PC87338 chip that
>controls two serial ports (i.e. SCC1 and SCC2). Naturally, I just had
>to use those two serial ports, and, of course, it doesn't have nice
>little jumpers to set IRQ and IO base addresses. Instead, it wants to
>be configured using Plug-n-Play which I obviously know nothing about.
>Anyways, I thought, hey, I'll investigate by using this nifty
>isapnptools package. Silly me.
>
>But beyond my specific problem, I guess it got me to wondering in
>general about the proper way to write user space programs using
>inb/outb (and in my wildest fantasies of submiting a patch for
>isapnptools).
The best way here is to use the mmap facility of /proc/bus/pci to
mmap the IO space of the bus into your userland space, and then
write your own accessors.
Ben.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: io.h and I/O port access from user space
2002-02-05 22:17 ` Jeffrey D. Kowing
2002-02-05 22:34 ` Benjamin Herrenschmidt
@ 2002-02-05 23:07 ` Hollis Blanchard
2002-02-06 0:16 ` Jeffrey D. Kowing
1 sibling, 1 reply; 8+ messages in thread
From: Hollis Blanchard @ 2002-02-05 23:07 UTC (permalink / raw)
To: jeffrey.d.kowing1; +Cc: linuxppc-dev
On Tue, 2002-02-05 at 16:17, Jeffrey D. Kowing wrote:
>
> Specifically, I've got an inhouse 603ev/MPC106 board on a PC/104 form
> factor running a linuxppc 2.4.x kernel. I've been using an Adastra
> NSP-104 PC/104 module as my network interface card. That card,
> besides its ethernet chip, also has a Super I/O PC87338 chip that
> controls two serial ports (i.e. SCC1 and SCC2). Naturally, I just had
> to use those two serial ports, and, of course, it doesn't have nice
> little jumpers to set IRQ and IO base addresses. Instead, it wants to
> be configured using Plug-n-Play which I obviously know nothing about.
> Anyways, I thought, hey, I'll investigate by using this nifty
> isapnptools package. Silly me.
Have you tried enabling CONFIG_PNP and CONFIG_ISAPNP? That's all I had
to do to get ISA PnP working for an onboard sound card here.
-Hollis
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: io.h and I/O port access from user space
2002-02-05 23:07 ` Hollis Blanchard
@ 2002-02-06 0:16 ` Jeffrey D. Kowing
0 siblings, 0 replies; 8+ messages in thread
From: Jeffrey D. Kowing @ 2002-02-06 0:16 UTC (permalink / raw)
To: Hollis Blanchard; +Cc: linuxppc-dev
Hollis Blanchard writes:
> Have you tried enabling CONFIG_PNP and CONFIG_ISAPNP? That's all I had
> to do to get ISA PnP working for an onboard sound card here.
Yes, I had tried that but all I got was the following message on my
console during bootup:
isapnp: Scanning for PnP cards...
isapnp: No Plug & Play device found
I did notice that on my Redhat 7.1 host machine I have a
/usr/lib/modules/modules.isapnpmap file that I lack the equivalent for
on my target powerpc machine. The file is a listing of
vendor/device/function ids. Perhaps this may be important for the
CONFIG_ISAPNP functionality? Any suggestions or pointers welcome !
Anyways, thanks for the suggestion. I guess I need to go educate
myself on the PnP protocol a bit more.
Regards,
Jeff
--
Jeff Kowing
jeffrey.d.kowing1@jsc.nasa.gov
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: io.h and I/O port access from user space
2002-02-05 20:34 io.h and I/O port access from user space Jeffrey D. Kowing
2002-02-05 21:26 ` Jeffrey D. Kowing
2002-02-05 21:48 ` Hollis Blanchard
@ 2002-02-06 10:37 ` Geert Uytterhoeven
2 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2002-02-06 10:37 UTC (permalink / raw)
To: Jeffrey D. Kowing; +Cc: Linux/PPC Development
On Tue, 5 Feb 2002, Jeffrey D. Kowing wrote:
> Has anyone in powerpc land used the isapnptools ?
Yes, I modifed it to work on my LongTrail, using the mmap() /dev/mem method.
> Specifically, I've got an inhouse 603ev/MPC106 board on a PC/104 form
> factor running a linuxppc 2.4.x kernel. I've been using an Adastra
> NSP-104 PC/104 module as my network interface card. That card,
> besides its ethernet chip, also has a Super I/O PC87338 chip that
> controls two serial ports (i.e. SCC1 and SCC2). Naturally, I just had
> to use those two serial ports, and, of course, it doesn't have nice
> little jumpers to set IRQ and IO base addresses. Instead, it wants to
> be configured using Plug-n-Play which I obviously know nothing about.
> Anyways, I thought, hey, I'll investigate by using this nifty
> isapnptools package. Silly me.
Note that isapnptools didn't find anything ISA PnP on my box. My LongTrail has
the following ISA devices:
- NS87308VUL Super I/O controller, so-called PnP, but only using device
specific configuration, not generic ISA PnP
- Crystal/Cirrus CS4236B audio, so-called PnP, but only using device specific
configuration, not generic ISA PnP
- one (so far unused) ISA slot
Probably it's similar for your 87338.
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
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-02-06 10:37 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-05 20:34 io.h and I/O port access from user space Jeffrey D. Kowing
2002-02-05 21:26 ` Jeffrey D. Kowing
2002-02-05 21:48 ` Hollis Blanchard
2002-02-05 22:17 ` Jeffrey D. Kowing
2002-02-05 22:34 ` Benjamin Herrenschmidt
2002-02-05 23:07 ` Hollis Blanchard
2002-02-06 0:16 ` Jeffrey D. Kowing
2002-02-06 10:37 ` Geert Uytterhoeven
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).