How does I/O ports work in linux kernel

Vineel Reddy vineel.kovvuri at gmail.com
Mon Oct 1 09:29:21 EDT 2012


Hi All,

I have read about I/O ports recently from many recommended books for linux.
Each of the book effectively taught me only two things
1. Reserving the I/O ports using request_region(...) function
2. Then access the I/O ports using inb, outb functions

Apart from repeated reading and googling I still have the following queries

Question 1:
The one thing that the books haven't sufficiently answered is 'how does
linux know to which device it should write or read from when we use inb and
outb functions'?
Say for example we are dealing with parallel port for instance. How does
linux know that the parallel port is registered at 0x378 ?

Question 2:
Who registers the parallel port at 0x378 ?
I have read somewhere that all the mapped ports can be found in
/proc/ioports.
Who generates this map. BIOS? or the Kernel?

Question 3:
How is */proc/ioports* different from */proc/iomem*(System Memory Map). Is
there any overlap between them(because 0x378  is also an address, so it
must be some where in the system map. right?) ?

Question 4:
Is 0x378 the physical address in the system memory map generated by BIOS as
stated here
http://www.pcguide.com/ref/mbsys/res/ioSummary-c.html
Or a logical address from above table remapped inside the RAM which is in
turn mapped at *0x00100000* physical


I am banging my head with all of these bits and pieces of information
without having a clue to stitch all of them together.
Please give me some pointers to understand them.
Thanks in advance.


Regards
Vineel Kumar Reddy Kovvuri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121001/0f85a58b/attachment.html 


More information about the Kernelnewbies mailing list