1 .. SPDX-License-Identifier: GPL-2.0 1 .. SPDX-License-Identifier: GPL-2.0 2 2 3 ======================================= 3 ======================================= 4 Configuring PCI Endpoint Using CONFIGFS 4 Configuring PCI Endpoint Using CONFIGFS 5 ======================================= 5 ======================================= 6 6 7 :Author: Kishon Vijay Abraham I <kishon@ti.com> 7 :Author: Kishon Vijay Abraham I <kishon@ti.com> 8 8 9 The PCI Endpoint Core exposes configfs entry ( 9 The PCI Endpoint Core exposes configfs entry (pci_ep) to configure the 10 PCI endpoint function and to bind the endpoint 10 PCI endpoint function and to bind the endpoint function 11 with the endpoint controller. (For introducing 11 with the endpoint controller. (For introducing other mechanisms to 12 configure the PCI Endpoint Function refer to [ 12 configure the PCI Endpoint Function refer to [1]). 13 13 14 Mounting configfs 14 Mounting configfs 15 ================= 15 ================= 16 16 17 The PCI Endpoint Core layer creates pci_ep dir 17 The PCI Endpoint Core layer creates pci_ep directory in the mounted configfs 18 directory. configfs can be mounted using the f 18 directory. configfs can be mounted using the following command:: 19 19 20 mount -t configfs none /sys/kernel/con 20 mount -t configfs none /sys/kernel/config 21 21 22 Directory Structure 22 Directory Structure 23 =================== 23 =================== 24 24 25 The pci_ep configfs has two directories at its 25 The pci_ep configfs has two directories at its root: controllers and 26 functions. Every EPC device present in the sys 26 functions. Every EPC device present in the system will have an entry in 27 the *controllers* directory and every EPF driv 27 the *controllers* directory and every EPF driver present in the system 28 will have an entry in the *functions* director 28 will have an entry in the *functions* directory. 29 :: 29 :: 30 30 31 /sys/kernel/config/pci_ep/ 31 /sys/kernel/config/pci_ep/ 32 .. controllers/ 32 .. controllers/ 33 .. functions/ 33 .. functions/ 34 34 35 Creating EPF Device 35 Creating EPF Device 36 =================== 36 =================== 37 37 38 Every registered EPF driver will be listed in 38 Every registered EPF driver will be listed in controllers directory. The 39 entries corresponding to EPF driver will be cr 39 entries corresponding to EPF driver will be created by the EPF core. 40 :: 40 :: 41 41 42 /sys/kernel/config/pci_ep/functions/ 42 /sys/kernel/config/pci_ep/functions/ 43 .. <EPF Driver1>/ 43 .. <EPF Driver1>/ 44 ... <EPF Device 11>/ 44 ... <EPF Device 11>/ 45 ... <EPF Device 21>/ 45 ... <EPF Device 21>/ 46 ... <EPF Device 31>/ << 47 .. <EPF Driver2>/ 46 .. <EPF Driver2>/ 48 ... <EPF Device 12>/ 47 ... <EPF Device 12>/ 49 ... <EPF Device 22>/ 48 ... <EPF Device 22>/ 50 49 51 In order to create a <EPF device> of the type 50 In order to create a <EPF device> of the type probed by <EPF Driver>, the 52 user has to create a directory inside <EPF Dri 51 user has to create a directory inside <EPF DriverN>. 53 52 54 Every <EPF device> directory consists of the f 53 Every <EPF device> directory consists of the following entries that can be 55 used to configure the standard configuration h 54 used to configure the standard configuration header of the endpoint function. 56 (These entries are created by the framework wh 55 (These entries are created by the framework when any new <EPF Device> is 57 created) 56 created) 58 :: 57 :: 59 58 60 .. <EPF Driver1>/ 59 .. <EPF Driver1>/ 61 ... <EPF Device 11>/ 60 ... <EPF Device 11>/ 62 ... vendorid 61 ... vendorid 63 ... deviceid 62 ... deviceid 64 ... revid 63 ... revid 65 ... progif_cod 64 ... progif_code 66 ... subclass_c 65 ... subclass_code 67 ... baseclass_ 66 ... baseclass_code 68 ... cache_line 67 ... cache_line_size 69 ... subsys_ven 68 ... subsys_vendor_id 70 ... subsys_id 69 ... subsys_id 71 ... interrupt_ 70 ... interrupt_pin 72 ... <Symlink E << 73 ... primary/ << 74 ... <S << 75 ... secondary/ << 76 ... <S << 77 << 78 If an EPF device has to be associated with 2 E << 79 Non-transparent bridge), symlink of endpoint c << 80 interface should be added in 'primary' directo << 81 controller connected to secondary interface sh << 82 directory. << 83 << 84 The <EPF Device> directory can have a list of << 85 (<Symlink EPF Device 31>) to other <EPF Device << 86 be created by the user to represent the virtua << 87 the physical function. In the above directory << 88 physical function and <EPF Device 31> is a vir << 89 it's linked to another EPF device, cannot be l << 90 71 91 EPC Device 72 EPC Device 92 ========== 73 ========== 93 74 94 Every registered EPC device will be listed in 75 Every registered EPC device will be listed in controllers directory. The 95 entries corresponding to EPC device will be cr 76 entries corresponding to EPC device will be created by the EPC core. 96 :: 77 :: 97 78 98 /sys/kernel/config/pci_ep/controllers/ 79 /sys/kernel/config/pci_ep/controllers/ 99 .. <EPC Device1>/ 80 .. <EPC Device1>/ 100 ... <Symlink EPF Devic 81 ... <Symlink EPF Device11>/ 101 ... <Symlink EPF Devic 82 ... <Symlink EPF Device12>/ 102 ... start 83 ... start 103 .. <EPC Device2>/ 84 .. <EPC Device2>/ 104 ... <Symlink EPF Devic 85 ... <Symlink EPF Device21>/ 105 ... <Symlink EPF Devic 86 ... <Symlink EPF Device22>/ 106 ... start 87 ... start 107 88 108 The <EPC Device> directory will have a list of 89 The <EPC Device> directory will have a list of symbolic links to 109 <EPF Device>. These symbolic links should be c 90 <EPF Device>. These symbolic links should be created by the user to 110 represent the functions present in the endpoin !! 91 represent the functions present in the endpoint device. 111 that represents a physical function can be lin << 112 92 113 The <EPC Device> directory will also have a *s 93 The <EPC Device> directory will also have a *start* field. Once 114 "1" is written to this field, the endpoint dev 94 "1" is written to this field, the endpoint device will be ready to 115 establish the link with the host. This is usua 95 establish the link with the host. This is usually done after 116 all the EPF devices are created and linked wit 96 all the EPF devices are created and linked with the EPC device. 117 :: 97 :: 118 98 119 | controllers/ 99 | controllers/ 120 | <Directory: 100 | <Directory: EPC name>/ 121 | <Sym 101 | <Symbolic Link: Function> 122 | star 102 | start 123 | functions/ 103 | functions/ 124 | <Directory: 104 | <Directory: EPF driver>/ 125 | <Dir 105 | <Directory: EPF device>/ 126 106 | vendorid 127 107 | deviceid 128 108 | revid 129 109 | progif_code 130 110 | subclass_code 131 111 | baseclass_code 132 112 | cache_line_size 133 113 | subsys_vendor_id 134 114 | subsys_id 135 115 | interrupt_pin 136 116 | function 137 117 138 [1] Documentation/PCI/endpoint/pci-endpoint.rs !! 118 [1] :doc:`pci-endpoint`
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.