Accessing PCIe device memory using dd

Board has iMX8, is Verdin. I have a PCIe device that I know the value programmed into the base address register after enumeration. The memory enable bit is set. BAR0 is 0x18108000. I want to access the memory on the board using shell commands.

I am trying to use dd to read/write to the memory at that address. I tried:

dd if=/dev/mem count=4 bs=1 skip=$((0x18108000))

that got me

“Bad address”

So, I am thinking /dev/mem can’t access the physical address that the BAR has programmed into it.

I also tried using the device directly:

dd if=/sys/bus/pci/devices/0000:01:00.0/resource0 count=4 bs=1

that gets me “Input/Output error”

Any thoughts on how to get this to work, or any other method to directly access a PCIe device’s memory from the command prompt?

Shell is /bin/sh, image is Redx.

I know the board works, as I can get to everything on my Windows PC using RWEverything. Also, a C program on the iMX8 can access it just fine as well. I want to find a way to access it using only command prompt commands.

Any insight appreciated. I believe devmem would do what I want, but it’s not in this distribution that I can find. And I don’t want to load all of busybox…if it even would.

Austin

I took the easy way out, though I’d still like to figure out how to get dd to work.

I found the source for devmem, compiled it, loaded it and it works as expected.