PCI mmap - How do I access a PCI board address space?

gregory.menke at gsfc.nasa.gov gregory.menke at gsfc.nasa.gov
Thu Sep 25 22:28:32 UTC 2003


Chris Caudle writes:
 > Gregm asked:
 > > What does protected mode or DOS have to do with anything? 
 > 
 > DOS runs in real mode, which means you don't have access to 32 bit
 > memory space.  Historically, the limited address space of X86
 > devices is what led to splitting access into I/O space and memory
 > space.  With 32 bit address space, you have enough addresses that
 > you can waste some on device mapping, since until recently, few
 > systems had 4GB of physical memory.  Hence, systems which run
 > protected mode, such as RTEMS, are tending to gravitate toward
 > completely memory mapped devices, and systems which run in real
 > mode, such as DOS, tend to still use I/O access since you don't
 > want to give up your 1MB memory space to map device access.
 > 

This is well established, but it really is irrelevant to the
usefulness of IO space.  Protected mode doesn't have anything to do
with IO space or memory mapping- its true the larger address space
that it provides reduces the need for something like IO space but that
is the only relationship.  Memory mapping is often preferred simply
because its more convienent.


 > Since RTEMS runs in 32 bit flat memory space, it seems that using
 > memory mapped I/O wherever possible would make application code
 > more portable than if you had to worry about some processors using
 > memory mapped devices and X86 using I/O access.

The IO vs mem map portablility issue has long been solved.  If you're
talking to a device thats IO mapped, then use the classical IO
primitives.  On exclusively memory mapped architectures, this devolves
to memory map primitives translated to IO transactions on the PCI bus.
Memory map primitives work straight away regardless.  The difference
between IO mapped vs memory mapped is quite irrelevant wrt anything
but the convienence and/or requirements of the hardware designers.

The real potential for portability problems is in using memcpy/pointer
dereferencing to talk to hardware, in that respect IO primitives are
conceptually more portable since there is only one way to invoke them.

Gregm




More information about the users mailing list