I have an old PCI device that uses DPRAM. I think Linux is supposed to automatically map the DPRAM to a location in memory - but I'm not sure of this. I found /proc/iomem
that may contain the mapping. But I don't know how to identify my PCI device based on what's in /proc/iomem
.
I have two questions. First, is /proc/iomem
the right place to be looking? Second, how do I interpret what's in /proc/iomem
to know what the right address is?
I called sudo cat /proc/iomem
. The output looked like:
fc800000-fe7fffff : PCI Bus 0000:00
fd000000-fd69ffff : pnp 00:0d
fd6a0000-fd6affff : INT3450:00
fd6a0000-fd6affff : INT3450:00 INT3450:00
fd6b0000-fd6bffff : INT3450:00
But I don't know how to interpret everything after the : on each line.
You are correct that /proc/iomem
shows the mapping of PCI(e) memory (and different things) into linearly addressable memory.
The format of iomem
is (among other things):
<addr1>-<addr2> : <component>
Here, <component>
can be
0000:00:08:0
)pnp
) that can be dynamically allocatedFor your purpose you can use the lspci
command to identify your PCI device address to find the memory ranges it is mapped to.
For example, on my system I can run lspci
and see
$ lspci
[...]
01:00.1 Audio device: NVIDIA Corporation Device 10fa (rev a1)
[...]
Now I know that my NVIDIA audio device has PCI address 01:00.1
which I can use to find the memory region in /proc/iomem
:
$ sudo cat /proc/iomem | grep '01:00.1'
ae000000-ae003fff : 0000:01:00.1