Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: General Schvantzkoph Newsgroups: comp.os.linux.hardware,comp.arch.fpga Subject: Re: Is there a utility to peek and poke PCIe devices Date: 11 Aug 2011 13:21:16 GMT Lines: 50 Message-ID: <9ai3abFf73U4@mid.individual.net> References: <9agc44Ff73U3@mid.individual.net> <4e437d24$0$6539$9b4e6d93@newsspool4.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net IVFpoy0Tyg7SKwYfRuAQNwvwwjq76d6sqUIiyvf6n8jTLylzUP Cancel-Lock: sha1:OuQsb0vQT8OFF2Ap3XQTDg7KKhM= User-Agent: Pan/0.133 (House of Butterflies) Xref: x330-a1.tempe.blueboxinc.net comp.os.linux.hardware:569 comp.arch.fpga:1667 On Thu, 11 Aug 2011 08:57:05 +0200, rndhro wrote: > On 08/10/11 23:39, General Schvantzkoph wrote: >> Is there a utility that does peeks and pokes to PCIe devices. I'm >> developing an FPGA with a PCIe interface and I'd like to do some simple >> memory accesses before I move on to the more complicated things like >> DMA. We have a driver in development but I think there is a standard >> Altera driver already in the kernel which I assume would be good enough >> for simple accesses. >> >> I'm running on Scientific Linux 6.1. >> >> lspci identifies the device as an Altera device which is correct. >> >> 01:00.0 Unassigned class [ff00]: Altera Corporation Device 0004 (rev >> 01) > > you don't even need a driver for simple memory access. if your device is > detected by the kernel you can directly access the BARs via sysfs: # ls > -l /sys/bus/pci/devices/0000\:01\:00.0/ [...] > -rw------- 1 root root 256M Aug 11 08:51 resource0 -rw------- 1 root > root 256 Aug 11 08:51 resource1 -rw------- 1 root root 64K Aug 2 > 08:14 resource2 [...] > > This is an example of a device with 3 BARs. These files can be > read/written/mmapped... you could use "dd" or write a little C program > to mmap the files. > > HTH How do I determine which device is mine? Here is the lspci output 01:00.0 Unassigned class [ff00]: Altera Corporation Device 0004 (rev 01) Here are the devices under /sys/bus/pci_express/devices 0000:00:0b.0:pcie01/ 0000:00:0c.0:pcie01/ 0000:00:0d.0:pcie01/ 0000:00:0e.0:pcie01/ 0000:00:0b.0:pcie08/ 0000:00:0c.0:pcie08/ 0000:00:0d.0:pcie08/ 0000:00:0e.0:pcie08 Here are the devices under /sys/bus/pci/devices 0000:00:00.0/ 0000:00:02.0/ 0000:00:06.0/ 0000:00:09.0/ 0000:00:0c.0/ 0000:00:18.0/ 0000:00:18.3/ 0000:05:00.0/ 0000:00:01.0/ 0000:00:02.1/ 0000:00:07.0/ 0000:00:0a.0/ 0000:00:0d.0/ 0000:00:18.1/ 0000:01:0d.0/ 0000:00:01.1/ 0000:00:04.0/ 0000:00:08.0/ 0000:00:0b.0/ 0000:00:0e.0/ 0000:00:18.2/ 0000:03:00.0