tech-misc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Regarding PCIe peek/poke in NetBSD



On Tue, Jan 04, 2011 at 03:19:26PM +0000, Jonathan A. Kollasch wrote:
> On Tue, Jan 04, 2011 at 01:45:24PM +0100, Manuel Bouyer wrote:
> > On Tue, Jan 04, 2011 at 10:47:30AM +0530, Gnanasekar Loganathan wrote:
> > > Hi Manuel,
> > > 
> > > The requirement was, one of my customer want to do read/write on any
> > > address/offset from any PCIe devices present in the system. He don't
> > > want to use the corresponding device drivers, need separate
> > > application that can map the PCIe device region of any devices by bus
> > > no, device no and function. The application meant for testing purpose
> > > only.
> > > 
> > > Using the 'pcictl' utility i can able to do read/write operations on
> > > PCIe configuration space, but not able to do in io/mem/prefetchable
> > > space.  Able to map the region by 'bus_space_map', if the region was
> > > not already mapped by the driver. bus_space_map fails if it was
> > > already mapped.
> > > 
> > > Is there any way  to map the region which was already mapped by the 
> > > driver?

Mappings to kernel (driver) and userspace are very different.  This
is not clearly documented, but my understanding is that you can't
mmap devices that are already mapped to kernel (as unmanaged).

> > 
> > Well, this is not so easy.
> > For I/O space, I guess they can be acceeded using the i386_iopl(2) call
> > (assuming you're on x86 hardware). For memory-mapped space, maybe
> > they can be acceeded using /dev/mem, but I never tried this.
> 
> Also, you can mmap(4) /dev/pci now ...

Yes, and it's backend is sooooo MD.


Home | Main Index | Thread Index | Old Index