Accessing PCI registers in user space
From: Joe Mulligan (joem_at_foresightimaging.com)
Date: 08/25/04
- Next message: Floyd L. Davidson: "Re: display output from serial port device"
- Previous message: Grant Edwards: "Re: display output from serial port device"
- Next in thread: Måns Rullgård: "Re: Accessing PCI registers in user space"
- Reply: Måns Rullgård: "Re: Accessing PCI registers in user space"
- Reply: Georg Acher: "Re: Accessing PCI registers in user space"
- Reply: Robert Redelmeier: "Re: Accessing PCI registers in user space"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Aug 2004 07:04:18 -0700
I'm a kernel newbie with a problem that I know has been answered
before, but none of the solutions that I found through net/docs
research seem to work.
I'm porting software for a PCI card (AMCC 5935 based). What I'm
trying to do is map the board's register region into user space so it
can be accessed via a pointer. Please, no lectures about how
unportable this is, I'm dealing with a large library that insists on
using pointers on X86 based systems.
I retrieve the physical addresses from the pci config space. If I
access the registers in the driver via io_remap_nocache then
readl/writel then all is fine. If I pass the physical addresses back
up to user space then attempt to map via mmap() then I get a good
virtual address that doesn't point to the registers. I have a scope
on the board so I've confirmed that this is the case. Im assuming
that there may be some caching going on.
I've seen articles that recommend opening /dev/mem and mapping the
registers using that file descriptor, but I get the same results. I've
based my device mmap on the code from the Rubini/Corbet book. I've
been trying for 2 days now with various combinations of
io_remap_nocache/virt_to_phys and remap_page_range calls with no luck.
I've also tried various flags to the vma page protection (page_pcd,
page_pwt) also with no luck.
I'm using the 2.4 kernel with a Red Hat distro.
Could someone please post the proper sequence, including flags to
accomplish this ?
Any help would be greatly appreciated.
Thank you,
joem@foresightimaging.com
Could some
- Next message: Floyd L. Davidson: "Re: display output from serial port device"
- Previous message: Grant Edwards: "Re: display output from serial port device"
- Next in thread: Måns Rullgård: "Re: Accessing PCI registers in user space"
- Reply: Måns Rullgård: "Re: Accessing PCI registers in user space"
- Reply: Georg Acher: "Re: Accessing PCI registers in user space"
- Reply: Robert Redelmeier: "Re: Accessing PCI registers in user space"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|