EDAboard.com | EDAboard.eu | EDAboard.de | EDAboard.co.uk | RTV forum PL | NewsGroups PL

Is there a utility to peek and poke PCIe devices

Ask a question - edaboard.com

elektroda.net NewsGroups Forum Index - FPGA - Is there a utility to peek and poke PCIe devices

General Schvantzkoph
Guest

Wed Aug 10, 2011 9:39 pm   



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)

rndhro
Guest

Thu Aug 11, 2011 6:57 am   



On 08/10/11 23:39, General Schvantzkoph wrote:
Quote:
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

glen herrmannsfeldt
Guest

Thu Aug 11, 2011 10:33 am   



In comp.arch.fpga rndhro <rnd_at_hro.org> wrote:
Quote:
On 08/10/11 23:39, General Schvantzkoph wrote:
Is there a utility that does peeks and pokes to PCIe devices.

(snip)
Quote:
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
[...]

I remember doing this with VME based Suns and SunOS.
Device mapped VME addressing space, and memory mapped files
combine to form memory mapped memory space.

-- glen

General Schvantzkoph
Guest

Thu Aug 11, 2011 1:21 pm   



On Thu, 11 Aug 2011 08:57:05 +0200, rndhro wrote:

Quote:
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

rndhro
Guest

Thu Aug 11, 2011 1:55 pm   



Quote:
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)

you should be able to use the pci-ID from lspci as directory name in
/sys/bus/pcie/devices/

Quote:
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

I don't really know why your device 0000:01:00.0 doesn't appear here -
did you list the directory on the same machine & while the card is
detected? Just a guess: maybe you have to set a device class in the FPGA
Firmware other than ff00? (my Xilinx ML605 gets detected as "RAM memory"
for example by setting the appropriate device/vendor IDs)

General Schvantzkoph
Guest

Thu Aug 11, 2011 3:30 pm   



On Thu, 11 Aug 2011 15:55:33 +0200, rndhro wrote:

Quote:
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)

you should be able to use the pci-ID from lspci as directory name in
/sys/bus/pcie/devices/

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

I don't really know why your device 0000:01:00.0 doesn't appear here -
did you list the directory on the same machine & while the card is
detected? Just a guess: maybe you have to set a device class in the FPGA
Firmware other than ff00? (my Xilinx ML605 gets detected as "RAM memory"
for example by setting the appropriate device/vendor IDs)

I'm switching the class to 5 from FF, I'll see what happens.

elektroda.net NewsGroups Forum Index - FPGA - Is there a utility to peek and poke PCIe devices

Ask a question - edaboard.com

Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
RTV map EDAboard.com map News map EDAboard.eu map EDAboard.de map EDAboard.co.uk map Opony