2 Kishon Vijay Abraham I <kishon@ti.com>
4 This document is a guide to help users use pci-epf-test function driver
5 and pci_endpoint_test host driver for testing PCI. The list of steps to
6 be followed in the host side and EP side is given below.
10 1.1 Endpoint Controller Devices
12 To find the list of endpoint controller devices in the system:
14 # ls /sys/class/pci_epc/
17 If PCI_ENDPOINT_CONFIGFS is enabled
18 # ls /sys/kernel/config/pci_ep/controllers
21 1.2 Endpoint Function Drivers
23 To find the list of endpoint function drivers in the system:
25 # ls /sys/bus/pci-epf/drivers
28 If PCI_ENDPOINT_CONFIGFS is enabled
29 # ls /sys/kernel/config/pci_ep/functions
32 1.3 Creating pci-epf-test Device
34 PCI endpoint function device can be created using the configfs. To create
35 pci-epf-test device, the following commands can be used
37 # mount -t configfs none /sys/kernel/config
38 # cd /sys/kernel/config/pci_ep/
39 # mkdir functions/pci_epf_test/func1
41 The "mkdir func1" above creates the pci-epf-test function device that will
42 be probed by pci_epf_test driver.
44 The PCI endpoint framework populates the directory with the following
47 # ls functions/pci_epf_test/func1
48 baseclass_code interrupt_pin progif_code subsys_id
49 cache_line_size msi_interrupts revid subsys_vendorid
50 deviceid msix_interrupts subclass_code vendorid
52 The PCI endpoint function driver populates these entries with default values
53 when the device is bound to the driver. The pci-epf-test driver populates
54 vendorid with 0xffff and interrupt_pin with 0x0001
56 # cat functions/pci_epf_test/func1/vendorid
58 # cat functions/pci_epf_test/func1/interrupt_pin
61 1.4 Configuring pci-epf-test Device
63 The user can configure the pci-epf-test device using configfs entry. In order
64 to change the vendorid and the number of MSI interrupts used by the function
65 device, the following commands can be used.
67 # echo 0x104c > functions/pci_epf_test/func1/vendorid
68 # echo 0xb500 > functions/pci_epf_test/func1/deviceid
69 # echo 16 > functions/pci_epf_test/func1/msi_interrupts
70 # echo 8 > functions/pci_epf_test/func1/msix_interrupts
72 1.5 Binding pci-epf-test Device to EP Controller
74 In order for the endpoint function device to be useful, it has to be bound to
75 a PCI endpoint controller driver. Use the configfs to bind the function
76 device to one of the controller driver present in the system.
78 # ln -s functions/pci_epf_test/func1 controllers/51000000.pcie_ep/
80 Once the above step is completed, the PCI endpoint is ready to establish a link
85 In order for the endpoint device to establish a link with the host, the _start_
86 field should be populated with '1'.
88 # echo 1 > controllers/51000000.pcie_ep/start
94 Note that the devices listed here correspond to the value populated in 1.4 above
96 00:00.0 PCI bridge: Texas Instruments Device 8888 (rev 01)
97 01:00.0 Unassigned class [ff00]: Texas Instruments Device b500
99 2.2 Using Endpoint Test function Device
101 pcitest.sh added in tools/pci/ can be used to run all the default PCI endpoint
102 tests. Before pcitest.sh can be used pcitest.c should be compiled using the
106 make headers_install ARCH=arm
107 arm-linux-gnueabihf-gcc -Iusr/include tools/pci/pcitest.c -o pcitest
108 cp pcitest <rootfs>/usr/sbin/
109 cp tools/pci/pcitest.sh <rootfs>
111 2.2.1 pcitest.sh Output
124 SET IRQ TYPE TO LEGACY: OKAY
126 SET IRQ TYPE TO MSI: OKAY
159 SET IRQ TYPE TO MSI-X: OKAY
182 SET IRQ TYPE TO MSI: OKAY
183 READ ( 1 bytes): OKAY
184 READ ( 1024 bytes): OKAY
185 READ ( 1025 bytes): OKAY
186 READ (1024000 bytes): OKAY
187 READ (1024001 bytes): OKAY
191 WRITE ( 1 bytes): OKAY
192 WRITE ( 1024 bytes): OKAY
193 WRITE ( 1025 bytes): OKAY
194 WRITE (1024000 bytes): OKAY
195 WRITE (1024001 bytes): OKAY
199 COPY ( 1 bytes): OKAY
200 COPY ( 1024 bytes): OKAY
201 COPY ( 1025 bytes): OKAY
202 COPY (1024000 bytes): OKAY
203 COPY (1024001 bytes): OKAY