1 .. SPDX-License-Identifier: GPL-2.0
7 :Author: Kishon Vijay Abraham I <kishon@ti.com>
9 This document is a guide to help users use pci-epf-test function driver
10 and pci_endpoint_test host driver for testing PCI. The list of steps to
11 be followed in the host side and EP side is given below.
16 Endpoint Controller Devices
17 ---------------------------
19 To find the list of endpoint controller devices in the system::
21 # ls /sys/class/pci_epc/
24 If PCI_ENDPOINT_CONFIGFS is enabled::
26 # ls /sys/kernel/config/pci_ep/controllers
30 Endpoint Function Drivers
31 -------------------------
33 To find the list of endpoint function drivers in the system::
35 # ls /sys/bus/pci-epf/drivers
38 If PCI_ENDPOINT_CONFIGFS is enabled::
40 # ls /sys/kernel/config/pci_ep/functions
44 Creating pci-epf-test Device
45 ----------------------------
47 PCI endpoint function device can be created using the configfs. To create
48 pci-epf-test device, the following commands can be used::
50 # mount -t configfs none /sys/kernel/config
51 # cd /sys/kernel/config/pci_ep/
52 # mkdir functions/pci_epf_test/func1
54 The "mkdir func1" above creates the pci-epf-test function device that will
55 be probed by pci_epf_test driver.
57 The PCI endpoint framework populates the directory with the following
60 # ls functions/pci_epf_test/func1
61 baseclass_code interrupt_pin progif_code subsys_id
62 cache_line_size msi_interrupts revid subsys_vendorid
63 deviceid msix_interrupts subclass_code vendorid
65 The PCI endpoint function driver populates these entries with default values
66 when the device is bound to the driver. The pci-epf-test driver populates
67 vendorid with 0xffff and interrupt_pin with 0x0001::
69 # cat functions/pci_epf_test/func1/vendorid
71 # cat functions/pci_epf_test/func1/interrupt_pin
75 Configuring pci-epf-test Device
76 -------------------------------
78 The user can configure the pci-epf-test device using configfs entry. In order
79 to change the vendorid and the number of MSI interrupts used by the function
80 device, the following commands can be used::
82 # echo 0x104c > functions/pci_epf_test/func1/vendorid
83 # echo 0xb500 > functions/pci_epf_test/func1/deviceid
84 # echo 16 > functions/pci_epf_test/func1/msi_interrupts
85 # echo 8 > functions/pci_epf_test/func1/msix_interrupts
88 Binding pci-epf-test Device to EP Controller
89 --------------------------------------------
91 In order for the endpoint function device to be useful, it has to be bound to
92 a PCI endpoint controller driver. Use the configfs to bind the function
93 device to one of the controller driver present in the system::
95 # ln -s functions/pci_epf_test/func1 controllers/51000000.pcie_ep/
97 Once the above step is completed, the PCI endpoint is ready to establish a link
104 In order for the endpoint device to establish a link with the host, the _start_
105 field should be populated with '1'::
107 # echo 1 > controllers/51000000.pcie_ep/start
116 Note that the devices listed here correspond to the value populated in 1.4
119 00:00.0 PCI bridge: Texas Instruments Device 8888 (rev 01)
120 01:00.0 Unassigned class [ff00]: Texas Instruments Device b500
123 Using Endpoint Test function Device
124 -----------------------------------
126 pcitest.sh added in tools/pci/ can be used to run all the default PCI endpoint
127 tests. To compile this tool the following commands should be used::
132 or if you desire to compile and install in your system::
135 # make -C tools/pci install
137 The tool and script will be located in <rootfs>/usr/bin/
156 SET IRQ TYPE TO LEGACY: OKAY
158 SET IRQ TYPE TO MSI: OKAY
191 SET IRQ TYPE TO MSI-X: OKAY
214 SET IRQ TYPE TO MSI: OKAY
215 READ ( 1 bytes): OKAY
216 READ ( 1024 bytes): OKAY
217 READ ( 1025 bytes): OKAY
218 READ (1024000 bytes): OKAY
219 READ (1024001 bytes): OKAY
223 WRITE ( 1 bytes): OKAY
224 WRITE ( 1024 bytes): OKAY
225 WRITE ( 1025 bytes): OKAY
226 WRITE (1024000 bytes): OKAY
227 WRITE (1024001 bytes): OKAY
231 COPY ( 1 bytes): OKAY
232 COPY ( 1024 bytes): OKAY
233 COPY ( 1025 bytes): OKAY
234 COPY (1024000 bytes): OKAY
235 COPY (1024001 bytes): OKAY