Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the meaning of the content of /proc/ioports

I got a strange text by 'catting' the /proc/ioports file of my PC linux,

0000-001f : dma1
0020-003f : pic1
0040-005f : timer
0060-006f : keyboard
0070-007f : rtc0
...

What I dont understand is the anterior part of each entry, look at the first entry for example, does it mean 31(0x1f in hex) ports occupied by dma1? If true, I cannot imagine how many ports on x86 processor, since I know there are only several 8bit ports on a 8bit-MCU.

Can anyone detail the meaning of the number, and the io ports of x86 processor?

like image 236
user718146 Avatar asked Oct 15 '11 14:10

user718146


2 Answers

It's the list of I/O ports regions that have been claimed by kernel drivers using the request_region kernel function. So it's not the complete list of I/O ports or devices available, only the ones that have been claimed by various kernel drivers. The request_region mechanism allows the kernel to prevent multiple drivers from talking to the same device.

like image 122
Thomas Petazzoni Avatar answered Nov 08 '22 05:11

Thomas Petazzoni


/proc/ioports lists the ranges and names of ioports provided by device drivers in the Linux kernel of ports of the port ranges claimed and handled by said drivers.

As an example, io ports 0070 - 007f are claimed by the RTC Linux kernel driver.

One would assume that said port ranges claimed by the driver correspond to the appropriate port ranges offered by the respective hardware but you should note that there is actually no mechanism that ensures that indeed they are.

like image 28
gby Avatar answered Nov 08 '22 05:11

gby