brintos

brintos / linux-shallow public Read only

0
0
Text · 4.3 KiB · fb73345 Raw
139 lines · plain
1.. SPDX-License-Identifier: GPL-2.02 3=======================================4Configuring PCI Endpoint Using CONFIGFS5=======================================6 7:Author: Kishon Vijay Abraham I <kishon@ti.com>8 9The PCI Endpoint Core exposes configfs entry (pci_ep) to configure the10PCI endpoint function and to bind the endpoint function11with the endpoint controller. (For introducing other mechanisms to12configure the PCI Endpoint Function refer to [1]).13 14Mounting configfs15=================16 17The PCI Endpoint Core layer creates pci_ep directory in the mounted configfs18directory. configfs can be mounted using the following command::19 20	mount -t configfs none /sys/kernel/config21 22Directory Structure23===================24 25The pci_ep configfs has two directories at its root: controllers and26functions. Every EPC device present in the system will have an entry in27the *controllers* directory and every EPF driver present in the system28will have an entry in the *functions* directory.29::30 31	/sys/kernel/config/pci_ep/32		.. controllers/33		.. functions/34 35Creating EPF Device36===================37 38Every registered EPF driver will be listed in controllers directory. The39entries corresponding to EPF driver will be created by the EPF core.40::41 42	/sys/kernel/config/pci_ep/functions/43		.. <EPF Driver1>/44			... <EPF Device 11>/45			... <EPF Device 21>/46			... <EPF Device 31>/47		.. <EPF Driver2>/48			... <EPF Device 12>/49			... <EPF Device 22>/50 51In order to create a <EPF device> of the type probed by <EPF Driver>, the52user has to create a directory inside <EPF DriverN>.53 54Every <EPF device> directory consists of the following entries that can be55used to configure the standard configuration header of the endpoint function.56(These entries are created by the framework when any new <EPF Device> is57created)58::59 60		.. <EPF Driver1>/61			... <EPF Device 11>/62				... vendorid63				... deviceid64				... revid65				... progif_code66				... subclass_code67				... baseclass_code68				... cache_line_size69				... subsys_vendor_id70				... subsys_id71				... interrupt_pin72			        ... <Symlink EPF Device 31>/73                                ... primary/74			                ... <Symlink EPC Device1>/75                                ... secondary/76			                ... <Symlink EPC Device2>/77 78If an EPF device has to be associated with 2 EPCs (like in the case of79Non-transparent bridge), symlink of endpoint controller connected to primary80interface should be added in 'primary' directory and symlink of endpoint81controller connected to secondary interface should be added in 'secondary'82directory.83 84The <EPF Device> directory can have a list of symbolic links85(<Symlink EPF Device 31>) to other <EPF Device>. These symbolic links should86be created by the user to represent the virtual functions that are bound to87the physical function. In the above directory structure <EPF Device 11> is a88physical function and <EPF Device 31> is a virtual function. An EPF device once89it's linked to another EPF device, cannot be linked to a EPC device.90 91EPC Device92==========93 94Every registered EPC device will be listed in controllers directory. The95entries corresponding to EPC device will be created by the EPC core.96::97 98	/sys/kernel/config/pci_ep/controllers/99		.. <EPC Device1>/100			... <Symlink EPF Device11>/101			... <Symlink EPF Device12>/102			... start103		.. <EPC Device2>/104			... <Symlink EPF Device21>/105			... <Symlink EPF Device22>/106			... start107 108The <EPC Device> directory will have a list of symbolic links to109<EPF Device>. These symbolic links should be created by the user to110represent the functions present in the endpoint device. Only <EPF Device>111that represents a physical function can be linked to a EPC device.112 113The <EPC Device> directory will also have a *start* field. Once114"1" is written to this field, the endpoint device will be ready to115establish the link with the host. This is usually done after116all the EPF devices are created and linked with the EPC device.117::118 119			 | controllers/120				| <Directory: EPC name>/121					| <Symbolic Link: Function>122					| start123			 | functions/124				| <Directory: EPF driver>/125					| <Directory: EPF device>/126						| vendorid127						| deviceid128						| revid129						| progif_code130						| subclass_code131						| baseclass_code132						| cache_line_size133						| subsys_vendor_id134						| subsys_id135						| interrupt_pin136						| function137 138[1] Documentation/PCI/endpoint/pci-endpoint.rst139