Saturday, March 14, 2015

User Space Device Drivers

http://www.embedded.com/design/operating-systems/4401769/Device-drivers-in-user-space

Memory mapped I/o vs port mapped I/o

Memory Mapped I/O:
memory mapped I/O allows writing/reading to I/O device ports the same as reading/writing to normal memory using same instructions use for memory.

Disadvantage:
Uses physical memory address space for memory mapped I/O devices. So we can not utilize that memory area from RAM.


I/O Mapped I/O:
Advantage of using the port mapped I/O method is that you have a separate address space for your I/O devices and you can use the whole memory addressing range to access memory.

I/o mapped devices uses special instructions to interact with devices.

Reference :

http://resources.infosecinstitute.com/system-address-map-initialization-in-x86x64-architecture-part-1-pci-based-systems/ - imp

http://duartes.org/gustavo/blog/post/motherboard-chipsets-memory-map/

http://www.bogotobogo.com/Embedded/memory_mapped_io_vs_port_mapped_isolated_io.php

http://www.brokenthorn.com/Resources/OSDev7.html


Info :

On an x86 pc the bios normally manages allocation of the flat/physical address space, and everything uses some place in that space. So the BIOS will "enumerate" the pcie devices by going out on each pcie slot to see if anyone is there. There are standard configuration registers that a pcie device must have some of which indicate how much address space and what kind (I/O based or Memory mapped). the bios attempts to make everyone happy and give them what they want. Windows or linux will not remap these devices or addresses, they take what is given to them by the bios. not every pcie system works that way but unfortunately this is how PC's work.