I am writing my first code to access device memory and I am a little confused about terminology.
The registers I want to read/write are in PCI device 0. The register set is at an offset (which I read successfully) and then an MMIO address.
It is not clear to me whether I access a "MMIO address" in a "MMIO range" the same way that I access normal memory and/or whether I have to map that first.
%%
Here's the verbose version:
- The register set I want in in device 0 and lives at an offset given in a word stored at 0x44 in device 0.
- So I do
pci_read_config_dword(dev0, 0x44, &mchbase);
- That works fine and returns 0xFED14000 for the base of the register set
- Then the register I want is at "MMIO Range 0xFED14000", address offset 0x114
How do I access that register?
I tried both
- pci_read_config_dword(dev0, mchbase + 0x114, &myval);
and
- readl((void *)(long)(mchbase + 0x114));
That gives me a kernel fault that they can't handle the paging request.
%%
So questions:
- do I have to map that memory first?
- do I access that just as normal memory via readl or do I need to do anything special for the MMIO range value?
Thanks
Martin