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 revid subsys_vendor_id
49 cache_line_size msi_interrupts subclass_code vendorid
50 deviceid progif_code subsys_id
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
71 1.5 Binding pci-epf-test Device to EP Controller
73 In order for the endpoint function device to be useful, it has to be bound to
74 a PCI endpoint controller driver. Use the configfs to bind the function
75 device to one of the controller driver present in the system.
77 # ln -s functions/pci_epf_test/func1 controllers/51000000.pcie_ep/
79 Once the above step is completed, the PCI endpoint is ready to establish a link
84 In order for the endpoint device to establish a link with the host, the _start_
85 field should be populated with '1'.
87 # echo 1 > controllers/51000000.pcie_ep/start
93 Note that the devices listed here correspond to the value populated in 1.4 above
95 00:00.0 PCI bridge: Texas Instruments Device 8888 (rev 01)
96 01:00.0 Unassigned class [ff00]: Texas Instruments Device b500
98 2.2 Using Endpoint Test function Device
100 pcitest.sh added in tools/pci/ can be used to run all the default PCI endpoint
101 tests. Before pcitest.sh can be used pcitest.c should be compiled using the
105 make headers_install ARCH=arm
106 arm-linux-gnueabihf-gcc -Iusr/include tools/pci/pcitest.c -o pcitest
107 cp pcitest <rootfs>/usr/sbin/
108 cp tools/pci/pcitest.sh <rootfs>
110 2.2.1 pcitest.sh Output
159 READ ( 1 bytes): OKAY
160 READ ( 1024 bytes): OKAY
161 READ ( 1025 bytes): OKAY
162 READ (1024000 bytes): OKAY
163 READ (1024001 bytes): OKAY
167 WRITE ( 1 bytes): OKAY
168 WRITE ( 1024 bytes): OKAY
169 WRITE ( 1025 bytes): OKAY
170 WRITE (1024000 bytes): OKAY
171 WRITE (1024001 bytes): OKAY
175 COPY ( 1 bytes): OKAY
176 COPY ( 1024 bytes): OKAY
177 COPY ( 1025 bytes): OKAY
178 COPY (1024000 bytes): OKAY
179 COPY (1024001 bytes): OKAY