public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* How do I access ioports from userspace?
@ 2003-09-25 23:03 Matthew Dharm
  2003-09-25 23:21 ` Greg KH
  2003-09-26  5:26 ` Frank v Waveren
  0 siblings, 2 replies; 9+ messages in thread
From: Matthew Dharm @ 2003-09-25 23:03 UTC (permalink / raw)
  To: Kernel Developer List

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

I'd like to be able to access some ioports to some custom hardware directly
from userspace, without creating a specialized kernel-level driver.  Is
there a way to do that?

Matt

-- 
Matthew Dharm                              Home: mdharm-usb@one-eyed-alien.net 
Maintainer, Linux USB Mass Storage Driver

M:  No, Windows doesn't have any nag screens.
C:  Then what are those blue and white screens I get every day?
					-- Mike and Cobb
User Friendly, 1/4/1999

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

* Re: How do I access ioports from userspace?
  2003-09-25 23:03 How do I access ioports from userspace? Matthew Dharm
@ 2003-09-25 23:21 ` Greg KH
  2003-09-26  5:26 ` Frank v Waveren
  1 sibling, 0 replies; 9+ messages in thread
From: Greg KH @ 2003-09-25 23:21 UTC (permalink / raw)
  To: Kernel Developer List

On Thu, Sep 25, 2003 at 04:03:51PM -0700, Matthew Dharm wrote:
> I'd like to be able to access some ioports to some custom hardware directly
> from userspace, without creating a specialized kernel-level driver.  Is
> there a way to do that?

/dev/port?

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

* Re: How do I access ioports from userspace?
  2003-09-25 23:03 How do I access ioports from userspace? Matthew Dharm
  2003-09-25 23:21 ` Greg KH
@ 2003-09-26  5:26 ` Frank v Waveren
  2003-09-26  7:27   ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 9+ messages in thread
From: Frank v Waveren @ 2003-09-26  5:26 UTC (permalink / raw)
  To: Kernel Developer List

On Thu, Sep 25, 2003 at 04:03:51PM -0700, Matthew Dharm wrote:
> I'd like to be able to access some ioports to some custom hardware directly
> from userspace, without creating a specialized kernel-level driver.  Is
> there a way to do that?
Either use /dev/port, or if it's performance critical (but not performance
critical enough to do in kernelspace), use ioperm/iopl and inb/outb.


-- 
Frank v Waveren                                      Fingerprint: 21A7 C7F3
fvw@[var.cx|stack.nl|dse.nl] ICQ#10074100               1FF3 47FF 545C CB53
Public key: hkp://wwwkeys.pgp.net/fvw@var.cx            7BD9 09C0 3AC1 6DF2

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

* Re: How do I access ioports from userspace?
  2003-09-26  5:26 ` Frank v Waveren
@ 2003-09-26  7:27   ` Benjamin Herrenschmidt
  2003-09-26  7:34     ` Frank v Waveren
  0 siblings, 1 reply; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2003-09-26  7:27 UTC (permalink / raw)
  To: Frank v Waveren; +Cc: Kernel Developer List

On Fri, 2003-09-26 at 07:26, Frank v Waveren wrote:
> On Thu, Sep 25, 2003 at 04:03:51PM -0700, Matthew Dharm wrote:
> > I'd like to be able to access some ioports to some custom hardware directly
> > from userspace, without creating a specialized kernel-level driver.  Is
> > there a way to do that?
> Either use /dev/port, or if it's performance critical (but not performance
> critical enough to do in kernelspace), use ioperm/iopl and inb/outb.

Simple note: the above will work on x86 only...

Ben.




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

* Re: How do I access ioports from userspace?
  2003-09-26  7:27   ` Benjamin Herrenschmidt
@ 2003-09-26  7:34     ` Frank v Waveren
  2003-09-26  7:40       ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 9+ messages in thread
From: Frank v Waveren @ 2003-09-26  7:34 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Kernel Developer List

On Fri, Sep 26, 2003 at 09:27:05AM +0200, Benjamin Herrenschmidt wrote:
> Simple note: the above will work on x86 only...
in[bwl]/out[bwl] are available on a lot more than just x86. Mind you, the
mechanisms are subtly different. Then again, if you're using direct hardware
access you're not going for portability anyway.

-- 
Frank v Waveren                                      Fingerprint: 21A7 C7F3
fvw@[var.cx|stack.nl|dse.nl] ICQ#10074100               1FF3 47FF 545C CB53
Public key: hkp://wwwkeys.pgp.net/fvw@var.cx            7BD9 09C0 3AC1 6DF2

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

* Re: How do I access ioports from userspace?
  2003-09-26  7:34     ` Frank v Waveren
@ 2003-09-26  7:40       ` Benjamin Herrenschmidt
  2003-09-26  8:29         ` Frank v Waveren
  2003-09-26  8:56         ` Jes Sorensen
  0 siblings, 2 replies; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2003-09-26  7:40 UTC (permalink / raw)
  To: Frank v Waveren; +Cc: Kernel Developer List

On Fri, 2003-09-26 at 09:34, Frank v Waveren wrote:
> On Fri, Sep 26, 2003 at 09:27:05AM +0200, Benjamin Herrenschmidt wrote:
> > Simple note: the above will work on x86 only...

> in[bwl]/out[bwl] are available on a lot more than just x86. Mind you, the
> mechanisms are subtly different. Then again, if you're using direct hardware
> access you're not going for portability anyway.

Are they from userland ? I doubt it...

Ben.



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

* Re: How do I access ioports from userspace?
  2003-09-26  7:40       ` Benjamin Herrenschmidt
@ 2003-09-26  8:29         ` Frank v Waveren
  2003-09-26  8:56         ` Jes Sorensen
  1 sibling, 0 replies; 9+ messages in thread
From: Frank v Waveren @ 2003-09-26  8:29 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Kernel Developer List

On Fri, Sep 26, 2003 at 09:40:42AM +0200, Benjamin Herrenschmidt wrote:
> > in[bwl]/out[bwl] are available on a lot more than just x86. Mind you, the
> > mechanisms are subtly different. Then again, if you're using direct hardware
> > access you're not going for portability anyway.
> Are they from userland ? I doubt it...
Have a look at your include files, they're defined everywhere, and defined
to something useful almost everywhere.

-- 
Frank v Waveren                                      Fingerprint: 21A7 C7F3
fvw@[var.cx|stack.nl|dse.nl] ICQ#10074100               1FF3 47FF 545C CB53
Public key: hkp://wwwkeys.pgp.net/fvw@var.cx            7BD9 09C0 3AC1 6DF2

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

* Re: How do I access ioports from userspace?
  2003-09-26  7:40       ` Benjamin Herrenschmidt
  2003-09-26  8:29         ` Frank v Waveren
@ 2003-09-26  8:56         ` Jes Sorensen
  2003-09-28 23:07           ` Peter Chubb
  1 sibling, 1 reply; 9+ messages in thread
From: Jes Sorensen @ 2003-09-26  8:56 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Frank v Waveren, Kernel Developer List

>>>>> "Ben" == Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:

Ben> On Fri, 2003-09-26 at 09:34, Frank v Waveren wrote:
>> in[bwl]/out[bwl] are available on a lot more than just x86. Mind
>> you, the mechanisms are subtly different. Then again, if you're
>> using direct hardware access you're not going for portability
>> anyway.

Ben> Are they from userland ? I doubt it...

Actually yes on some architectures, ia64 emulates it the ia32
API. That said, it's certainly not something one should be encouraged
to do, using MMIO is a far better approach.

Cheers,
Jes

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

* Re: How do I access ioports from userspace?
  2003-09-26  8:56         ` Jes Sorensen
@ 2003-09-28 23:07           ` Peter Chubb
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Chubb @ 2003-09-28 23:07 UTC (permalink / raw)
  To: Jes Sorensen
  Cc: Benjamin Herrenschmidt, Frank v Waveren, Kernel Developer List

>>>>> "Jes" == Jes Sorensen <jes@trained-monkey.org> writes:

>>>>> "Ben" == Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:
Ben> On Fri, 2003-09-26 at 09:34, Frank v Waveren wrote:
>>> in[bwl]/out[bwl] are available on a lot more than just x86. Mind
>>> you, the mechanisms are subtly different. Then again, if you're
>>> using direct hardware access you're not going for portability
>>> anyway.

Ben> Are they from userland ? I doubt it...

Jes> Actually yes on some architectures, ia64 emulates it the ia32
Jes> API. That said, it's certainly not something one should be
Jes> encouraged to do, using MMIO is a far better approach.

They're available at least in i386, alpha, ia64.
However  they allow access only to the first 64k of IO address space.
So you may not be able to access you device if it's in the wrong PCI
slot... 

--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
You are lost in a maze of BitKeeper repositories,   all slightly different.

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

end of thread, other threads:[~2003-09-28 23:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-25 23:03 How do I access ioports from userspace? Matthew Dharm
2003-09-25 23:21 ` Greg KH
2003-09-26  5:26 ` Frank v Waveren
2003-09-26  7:27   ` Benjamin Herrenschmidt
2003-09-26  7:34     ` Frank v Waveren
2003-09-26  7:40       ` Benjamin Herrenschmidt
2003-09-26  8:29         ` Frank v Waveren
2003-09-26  8:56         ` Jes Sorensen
2003-09-28 23:07           ` Peter Chubb

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