Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation: PCI: convert endpoint/pci-endpoint.txt to reST

Convert plain text documentation to reStructuredText format and add it to
Sphinx TOC tree. No essential content change.

Signed-off-by: Changbin Du <changbin.du@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

authored by

Changbin Du and committed by
Bjorn Helgaas
d8946fc3 4e37f055

+65 -38
+10
Documentation/PCI/endpoint/index.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ====================== 4 + PCI Endpoint Framework 5 + ====================== 6 + 7 + .. toctree:: 8 + :maxdepth: 2 9 + 10 + pci-endpoint
+54 -38
Documentation/PCI/endpoint/pci-endpoint.txt Documentation/PCI/endpoint/pci-endpoint.rst
··· 1 - PCI ENDPOINT FRAMEWORK 2 - Kishon Vijay Abraham I <kishon@ti.com> 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + :Author: Kishon Vijay Abraham I <kishon@ti.com> 3 4 4 5 This document is a guide to use the PCI Endpoint Framework in order to create 5 6 endpoint controller driver, endpoint function driver, and using configfs 6 7 interface to bind the function driver to the controller driver. 7 8 8 - 1. Introduction 9 + Introduction 10 + ============ 9 11 10 12 Linux has a comprehensive PCI subsystem to support PCI controllers that 11 13 operates in Root Complex mode. The subsystem has capability to scan PCI bus, ··· 21 19 EP system which can have a wide variety of use cases from testing or 22 20 validation, co-processor accelerator, etc. 23 21 24 - 2. PCI Endpoint Core 22 + PCI Endpoint Core 23 + ================= 25 24 26 25 The PCI Endpoint Core layer comprises 3 components: the Endpoint Controller 27 26 library, the Endpoint Function library, and the configfs layer to bind the 28 27 endpoint function with the endpoint controller. 29 28 30 - 2.1 PCI Endpoint Controller(EPC) Library 29 + PCI Endpoint Controller(EPC) Library 30 + ------------------------------------ 31 31 32 32 The EPC library provides APIs to be used by the controller that can operate 33 33 in endpoint mode. It also provides APIs to be used by function driver/library 34 34 in order to implement a particular endpoint function. 35 35 36 - 2.1.1 APIs for the PCI controller Driver 36 + APIs for the PCI controller Driver 37 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 38 38 39 This section lists the APIs that the PCI Endpoint core provides to be used 39 40 by the PCI controller driver. 40 41 41 - *) devm_pci_epc_create()/pci_epc_create() 42 + * devm_pci_epc_create()/pci_epc_create() 42 43 43 44 The PCI controller driver should implement the following ops: 45 + 44 46 * write_header: ops to populate configuration space header 45 47 * set_bar: ops to configure the BAR 46 48 * clear_bar: ops to reset the BAR ··· 57 51 The PCI controller driver can then create a new EPC device by invoking 58 52 devm_pci_epc_create()/pci_epc_create(). 59 53 60 - *) devm_pci_epc_destroy()/pci_epc_destroy() 54 + * devm_pci_epc_destroy()/pci_epc_destroy() 61 55 62 56 The PCI controller driver can destroy the EPC device created by either 63 57 devm_pci_epc_create() or pci_epc_create() using devm_pci_epc_destroy() or 64 58 pci_epc_destroy(). 65 59 66 - *) pci_epc_linkup() 60 + * pci_epc_linkup() 67 61 68 62 In order to notify all the function devices that the EPC device to which 69 63 they are linked has established a link with the host, the PCI controller 70 64 driver should invoke pci_epc_linkup(). 71 65 72 - *) pci_epc_mem_init() 66 + * pci_epc_mem_init() 73 67 74 68 Initialize the pci_epc_mem structure used for allocating EPC addr space. 75 69 76 - *) pci_epc_mem_exit() 70 + * pci_epc_mem_exit() 77 71 78 72 Cleanup the pci_epc_mem structure allocated during pci_epc_mem_init(). 79 73 80 - 2.1.2 APIs for the PCI Endpoint Function Driver 74 + 75 + APIs for the PCI Endpoint Function Driver 76 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 77 82 78 This section lists the APIs that the PCI Endpoint core provides to be used 83 79 by the PCI endpoint function driver. 84 80 85 - *) pci_epc_write_header() 81 + * pci_epc_write_header() 86 82 87 83 The PCI endpoint function driver should use pci_epc_write_header() to 88 84 write the standard configuration header to the endpoint controller. 89 85 90 - *) pci_epc_set_bar() 86 + * pci_epc_set_bar() 91 87 92 88 The PCI endpoint function driver should use pci_epc_set_bar() to configure 93 89 the Base Address Register in order for the host to assign PCI addr space. 94 90 Register space of the function driver is usually configured 95 91 using this API. 96 92 97 - *) pci_epc_clear_bar() 93 + * pci_epc_clear_bar() 98 94 99 95 The PCI endpoint function driver should use pci_epc_clear_bar() to reset 100 96 the BAR. 101 97 102 - *) pci_epc_raise_irq() 98 + * pci_epc_raise_irq() 103 99 104 100 The PCI endpoint function driver should use pci_epc_raise_irq() to raise 105 101 Legacy Interrupt, MSI or MSI-X Interrupt. 106 102 107 - *) pci_epc_mem_alloc_addr() 103 + * pci_epc_mem_alloc_addr() 108 104 109 105 The PCI endpoint function driver should use pci_epc_mem_alloc_addr(), to 110 106 allocate memory address from EPC addr space which is required to access 111 107 RC's buffer 112 108 113 - *) pci_epc_mem_free_addr() 109 + * pci_epc_mem_free_addr() 114 110 115 111 The PCI endpoint function driver should use pci_epc_mem_free_addr() to 116 112 free the memory space allocated using pci_epc_mem_alloc_addr(). 117 113 118 - 2.1.3 Other APIs 114 + Other APIs 115 + ~~~~~~~~~~ 119 116 120 117 There are other APIs provided by the EPC library. These are used for binding 121 118 the EPF device with EPC device. pci-ep-cfs.c can be used as reference for 122 119 using these APIs. 123 120 124 - *) pci_epc_get() 121 + * pci_epc_get() 125 122 126 123 Get a reference to the PCI endpoint controller based on the device name of 127 124 the controller. 128 125 129 - *) pci_epc_put() 126 + * pci_epc_put() 130 127 131 128 Release the reference to the PCI endpoint controller obtained using 132 129 pci_epc_get() 133 130 134 - *) pci_epc_add_epf() 131 + * pci_epc_add_epf() 135 132 136 133 Add a PCI endpoint function to a PCI endpoint controller. A PCIe device 137 134 can have up to 8 functions according to the specification. 138 135 139 - *) pci_epc_remove_epf() 136 + * pci_epc_remove_epf() 140 137 141 138 Remove the PCI endpoint function from PCI endpoint controller. 142 139 143 - *) pci_epc_start() 140 + * pci_epc_start() 144 141 145 142 The PCI endpoint function driver should invoke pci_epc_start() once it 146 143 has configured the endpoint function and wants to start the PCI link. 147 144 148 - *) pci_epc_stop() 145 + * pci_epc_stop() 149 146 150 147 The PCI endpoint function driver should invoke pci_epc_stop() to stop 151 148 the PCI LINK. 152 149 153 - 2.2 PCI Endpoint Function(EPF) Library 150 + 151 + PCI Endpoint Function(EPF) Library 152 + ---------------------------------- 154 153 155 154 The EPF library provides APIs to be used by the function driver and the EPC 156 155 library to provide endpoint mode functionality. 157 156 158 - 2.2.1 APIs for the PCI Endpoint Function Driver 157 + APIs for the PCI Endpoint Function Driver 158 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 159 159 160 160 This section lists the APIs that the PCI Endpoint core provides to be used 161 161 by the PCI endpoint function driver. 162 162 163 - *) pci_epf_register_driver() 163 + * pci_epf_register_driver() 164 164 165 165 The PCI Endpoint Function driver should implement the following ops: 166 166 * bind: ops to perform when a EPC device has been bound to EPF device ··· 178 166 The PCI Function driver can then register the PCI EPF driver by using 179 167 pci_epf_register_driver(). 180 168 181 - *) pci_epf_unregister_driver() 169 + * pci_epf_unregister_driver() 182 170 183 171 The PCI Function driver can unregister the PCI EPF driver by using 184 172 pci_epf_unregister_driver(). 185 173 186 - *) pci_epf_alloc_space() 174 + * pci_epf_alloc_space() 187 175 188 176 The PCI Function driver can allocate space for a particular BAR using 189 177 pci_epf_alloc_space(). 190 178 191 - *) pci_epf_free_space() 179 + * pci_epf_free_space() 192 180 193 181 The PCI Function driver can free the allocated space 194 182 (using pci_epf_alloc_space) by invoking pci_epf_free_space(). 195 183 196 - 2.2.2 APIs for the PCI Endpoint Controller Library 184 + APIs for the PCI Endpoint Controller Library 185 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 186 + 197 187 This section lists the APIs that the PCI Endpoint core provides to be used 198 188 by the PCI endpoint controller library. 199 189 200 - *) pci_epf_linkup() 190 + * pci_epf_linkup() 201 191 202 192 The PCI endpoint controller library invokes pci_epf_linkup() when the 203 193 EPC device has established the connection to the host. 204 194 205 - 2.2.2 Other APIs 195 + Other APIs 196 + ~~~~~~~~~~ 197 + 206 198 There are other APIs provided by the EPF library. These are used to notify 207 199 the function driver when the EPF device is bound to the EPC device. 208 200 pci-ep-cfs.c can be used as reference for using these APIs. 209 201 210 - *) pci_epf_create() 202 + * pci_epf_create() 211 203 212 204 Create a new PCI EPF device by passing the name of the PCI EPF device. 213 205 This name will be used to bind the the EPF device to a EPF driver. 214 206 215 - *) pci_epf_destroy() 207 + * pci_epf_destroy() 216 208 217 209 Destroy the created PCI EPF device. 218 210 219 - *) pci_epf_bind() 211 + * pci_epf_bind() 220 212 221 213 pci_epf_bind() should be invoked when the EPF device has been bound to 222 214 a EPC device. 223 215 224 - *) pci_epf_unbind() 216 + * pci_epf_unbind() 225 217 226 218 pci_epf_unbind() should be invoked when the binding between EPC device 227 219 and EPF device is lost.
+1
Documentation/PCI/index.rst
··· 15 15 acpi-info 16 16 pci-error-recovery 17 17 pcieaer-howto 18 + endpoint/index