mmap to Access PCI space?

From: Randall Hyde
Date: Thu Oct 23 2003 - 22:37:29 EST


Hi All,
I need to access a couple of SATA chips from a user-mode
program (yep, running as root). I know for a fact that my
chip resides at address 0xfc300000 (/proc/iomem and /proc/ide/siimage
tells me this). Can I do a mmap like the following to access the registers
on ths chip?

fdDevMem = open( "/dev/mem", O_RDWR );
ptr =
mmap
(
NULL,
4096,
PROT_READ | PROT_WRITE,
MAP_SHARED,
fdDevMem,
0xfc300000
);

When I try this, I get a valid pointer back, but it doesn't seem to
be mapped to my si3112 chip register bank.

I've also used code like the following:
ptr =
mmap
(
0xfc300000,
4096,
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS,
-1,
0
);

Same story.
If I use MAP_FIXED and/or MAP_PRIVATE, the mmap call fails.

What am I doing wrong here?
Thanks,
Randy Hyde

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/