Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On a single-board computer running Linux, is there a way to read the contents of the device configuration registers that control hardware? I think it would be a wrapper for inw(), more or less.

I'm looking for something equivalent to the U-boot memory dump (md) command, to be used in the context of driver debugging.

share|improve this question
This may help, but be sure to read the whole thread: lists.arm.linux.org.uk/lurker/message/… – Gilles Dec 17 '10 at 20:18
Any updates on this?? – Sen Dec 20 '10 at 8:09
@Sen: Negative. I'm still stumped. I read the linked thread, which suggests that inw() doesn't do what I thought: "inb() and friends are only for emulation of the PCI and ISA IO address space." I've been using an oscilloscope and reading a lot of kernel driver code as my next best options. – pingswept Dec 20 '10 at 17:02

I don't know if you can do it directly with a vanilla kernel.

But it should be quite strait forward to write a simple driver that uses a "file" in /proc to export the memory content you would like to see.

Then you can read your "file" with a simple script and have access to that memory.

share|improve this answer

If you know the physical address of the device, you can use devmem2.

devmem2 <physical address> <size (b/h/w)> [value]
share|improve this answer

I could be completely and totally wrong about this, and forgive me if I am, but if uboot's md command is just reading memory addresses mapped to device registers and returning the contents to you, couldn't you read those same memory locations with clever use of dd if=/dev/mem ...?

share|improve this answer
I think this route has potential, but it seems that there is a problem. This command executed as root: "dd if=/dev/mem bs=1 skip=10000 count=512" gives this error: "dd: /dev/mem: Bad address" I'm not sure what that means. Google tells me that it's something to do with changes introduced in the 2.6 kernel, but I don't understand enough about this yet to work around it. – pingswept Jan 3 '11 at 3:21
Maybe try using the mtdblock driver. Check this out: en.gentoo-wiki.com/wiki/Using_Graphics_Card_Memory_as_Swap But instead of pointing it to your graphics card RAM, maybe try pointing it to the device registers. – LawrenceC Jan 3 '11 at 15:51

Is the PCI device configuration in /sys/bus/pci/devices/*/config of any help?

share|improve this answer
This is really a comment, not an answer to the question. Please use "add comment" to leave feedback for the author. – Renan Aug 14 '12 at 2:08
@Renan "This is really a comment" Probably unintentional, but funny, regardless. +1 for brightening my day with tautology. edit: I just realized this might come off as sarcastic. I don't mean it that way. – root Jul 30 '13 at 19:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.