Re: mmap to Access PCI space?

From: David S. Miller
Date: Fri Oct 24 2003 - 02:59:16 EST


On Thu, 23 Oct 2003 20:36:12 -0700
"Randall Hyde" <randyhyde@xxxxxxxxxxxxx> wrote:

> 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
> );

That's not portable and will only work on a few platforms.
Please use mmap() and ioctl() operations on /proc/bus/pci/*
nodes to accomplish your task.
-
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/