]>
Commit | Line | Data |
---|---|---|
bea37d3d KVA |
1 | CONFIGURING PCI ENDPOINT USING CONFIGFS |
2 | Kishon Vijay Abraham I <kishon@ti.com> | |
3 | ||
4 | The PCI Endpoint Core exposes configfs entry (pci_ep) to configure the | |
5 | PCI endpoint function and to bind the endpoint function | |
6 | with the endpoint controller. (For introducing other mechanisms to | |
7 | configure the PCI Endpoint Function refer to [1]). | |
8 | ||
9 | *) Mounting configfs | |
10 | ||
11 | The PCI Endpoint Core layer creates pci_ep directory in the mounted configfs | |
12 | directory. configfs can be mounted using the following command. | |
13 | ||
14 | mount -t configfs none /sys/kernel/config | |
15 | ||
16 | *) Directory Structure | |
17 | ||
18 | The pci_ep configfs has two directories at its root: controllers and | |
19 | functions. Every EPC device present in the system will have an entry in | |
20 | the *controllers* directory and and every EPF driver present in the system | |
21 | will have an entry in the *functions* directory. | |
22 | ||
23 | /sys/kernel/config/pci_ep/ | |
24 | .. controllers/ | |
25 | .. functions/ | |
26 | ||
27 | *) Creating EPF Device | |
28 | ||
29 | Every registered EPF driver will be listed in controllers directory. The | |
30 | entries corresponding to EPF driver will be created by the EPF core. | |
31 | ||
32 | /sys/kernel/config/pci_ep/functions/ | |
33 | .. <EPF Driver1>/ | |
34 | ... <EPF Device 11>/ | |
35 | ... <EPF Device 21>/ | |
36 | .. <EPF Driver2>/ | |
37 | ... <EPF Device 12>/ | |
38 | ... <EPF Device 22>/ | |
39 | ||
40 | In order to create a <EPF device> of the type probed by <EPF Driver>, the | |
41 | user has to create a directory inside <EPF DriverN>. | |
42 | ||
43 | Every <EPF device> directory consists of the following entries that can be | |
44 | used to configure the standard configuration header of the endpoint function. | |
45 | (These entries are created by the framework when any new <EPF Device> is | |
46 | created) | |
47 | ||
48 | .. <EPF Driver1>/ | |
49 | ... <EPF Device 11>/ | |
50 | ... vendorid | |
51 | ... deviceid | |
52 | ... revid | |
53 | ... progif_code | |
54 | ... subclass_code | |
55 | ... baseclass_code | |
56 | ... cache_line_size | |
57 | ... subsys_vendor_id | |
58 | ... subsys_id | |
59 | ... interrupt_pin | |
60 | ||
61 | *) EPC Device | |
62 | ||
63 | Every registered EPC device will be listed in controllers directory. The | |
64 | entries corresponding to EPC device will be created by the EPC core. | |
65 | ||
66 | /sys/kernel/config/pci_ep/controllers/ | |
67 | .. <EPC Device1>/ | |
68 | ... <Symlink EPF Device11>/ | |
69 | ... <Symlink EPF Device12>/ | |
70 | ... start | |
71 | .. <EPC Device2>/ | |
72 | ... <Symlink EPF Device21>/ | |
73 | ... <Symlink EPF Device22>/ | |
74 | ... start | |
75 | ||
76 | The <EPC Device> directory will have a list of symbolic links to | |
77 | <EPF Device>. These symbolic links should be created by the user to | |
78 | represent the functions present in the endpoint device. | |
79 | ||
80 | The <EPC Device> directory will also have a *start* field. Once | |
81 | "1" is written to this field, the endpoint device will be ready to | |
82 | establish the link with the host. This is usually done after | |
83 | all the EPF devices are created and linked with the EPC device. | |
84 | ||
85 | ||
86 | | controllers/ | |
87 | | <Directory: EPC name>/ | |
88 | | <Symbolic Link: Function> | |
89 | | start | |
90 | | functions/ | |
91 | | <Directory: EPF driver>/ | |
92 | | <Directory: EPF device>/ | |
93 | | vendorid | |
94 | | deviceid | |
95 | | revid | |
96 | | progif_code | |
97 | | subclass_code | |
98 | | baseclass_code | |
99 | | cache_line_size | |
100 | | subsys_vendor_id | |
101 | | subsys_id | |
102 | | interrupt_pin | |
103 | | function | |
104 | ||
105 | [1] -> Documentation/PCI/endpoint/pci-endpoint.txt |