On Tue, 2014-03-04 at 10:45 -0700, Bjorn Helgaas wrote: > On Mon, Mar 3, 2014 at 8:59 PM, Pratyush Anand <pratyush.anand@xxxxxx> wrote: > > On Thu, Feb 27, 2014 at 05:12:38PM +0800, shiv prakash Agarwal wrote: > >> Hi All, > >> > >> > >> > >> One query: > >> > >> > >> > >> We can program config space registers of a pcie device using setpci but > >> how can we program private registers of a pcie device? > > > > You mean application specific registers? > > These registers will not be accessible through any generic user space program. > > > > If you want to access them for debug purposes then you can provide > > support in your driver. > > If the registers are in config space, you can use setpci, even if they > are non-architected registers specific to the device. > > If they are in MMIO space, you can use lspci to learn where the BARs > are mapped, and then use something like rdwrmem > (http://cmp.felk.cvut.cz/~pisa/linux/rdwrmem.c) to access the > registers. > > If they are in I/O port space, you can again use lspci to learn where > they are mapped, and then use ioperm()/iopl()/inb()/outb()/etc. The pci-sysfs resource# files are probably an easier alternative. MMIO regions can be mmap'd and I/O port regions support direct read/write. Thanks, Alex -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html