Reputation: 10468
I was wondering if Linux sees a difference between mmap to a peripheral devices memory in comparision to reading/writing to the device via I/O Ports. From what I've learned in my Assembly class, we pretty much looked at I/O port addressing in the same light as memory addressing. So I suppose I was wondering if I were to rw to the I/O my port my device is connected to, is that the same thing mmaping to that devices memory?
Thanks
Upvotes: 1
Views: 1420
Reputation: 4024
The vm_area_struct
contains vm_flags
field. In case of the special mapping it contains VM_PFNMAP
or VM_IO
flags. See struct vm_area_struct, VM_PFNMAP and VM_IO definitions at LXR.
Upvotes: 0
Reputation: 44230
I think the OP is confusing three things:
mmap() is a way for application programs to perform some operations on page registers and/or the MMU.
Memory mapped I/O is a hardware architecture concept: instead of having separate buses and operations for I/O, some area of the address space is dedicated to I/O operations. (the 68K processor family uses memory mapped I/O, and IBM's AIX too, IIRC).
DMA means that not only the CPU(s), but also the I/O devices can read and write to and from (parts of) physical memory.
Upvotes: 1
Reputation: 1
I/O ports are not memory. Some hardware (e.g. graphical cards) are interfaced thru the memory bus, not only thru the I/O port bus.
For hardware having a memory interface (that is, viewed as a range of memory to the CPU), you might use mmap
.
The X11 server Xorg
is very often mmap-ing the graphical cards.
Upvotes: 2