sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget-/translations/zh_CN/PCI/endpoint/pci-endpointmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget-/translations/zh_TW/PCI/endpoint/pci-endpointmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget-/translations/it_IT/PCI/endpoint/pci-endpointmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget-/translations/ja_JP/PCI/endpoint/pci-endpointmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget-/translations/ko_KR/PCI/endpoint/pci-endpointmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget-/translations/sp_SP/PCI/endpoint/pci-endpointmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhG/var/lib/git/docbuild/linux/Documentation/PCI/endpoint/pci-endpoint.rsthKubh paragraph)}(hThis document is a guide to use the PCI Endpoint Framework in order to create endpoint controller driver, endpoint function driver, and using configfs interface to bind the function driver to the controller driver.h]hThis document is a guide to use the PCI Endpoint Framework in order to create endpoint controller driver, endpoint function driver, and using configfs interface to bind the function driver to the controller driver.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubhsection)}(hhh](htitle)}(h Introductionh]h Introduction}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubh)}(hXWLinux has a comprehensive PCI subsystem to support PCI controllers that operates in Root Complex mode. The subsystem has capability to scan PCI bus, assign memory resources and IRQ resources, load PCI driver (based on vendor ID, device ID), support other services like hot-plug, power management, advanced error reporting and virtual channels.h]hXWLinux has a comprehensive PCI subsystem to support PCI controllers that operates in Root Complex mode. The subsystem has capability to scan PCI bus, assign memory resources and IRQ resources, load PCI driver (based on vendor ID, device ID), support other services like hot-plug, power management, advanced error reporting and virtual channels.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hXMHowever the PCI controller IP integrated in some SoCs is capable of operating either in Root Complex mode or Endpoint mode. PCI Endpoint Framework will add endpoint mode support in Linux. This will help to run Linux in an EP system which can have a wide variety of use cases from testing or validation, co-processor accelerator, etc.h]hXMHowever the PCI controller IP integrated in some SoCs is capable of operating either in Root Complex mode or Endpoint mode. PCI Endpoint Framework will add endpoint mode support in Linux. This will help to run Linux in an EP system which can have a wide variety of use cases from testing or validation, co-processor accelerator, etc.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h] introductionah ]h"] introductionah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hPCI Endpoint Coreh]hPCI Endpoint Core}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hThe PCI Endpoint Core layer comprises 3 components: the Endpoint Controller library, the Endpoint Function library, and the configfs layer to bind the endpoint function with the endpoint controller.h]hThe PCI Endpoint Core layer comprises 3 components: the Endpoint Controller library, the Endpoint Function library, and the configfs layer to bind the endpoint function with the endpoint controller.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(h$PCI Endpoint Controller(EPC) Libraryh]h$PCI Endpoint Controller(EPC) Library}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK ubh)}(hThe EPC library provides APIs to be used by the controller that can operate in endpoint mode. It also provides APIs to be used by function driver/library in order to implement a particular endpoint function.h]hThe EPC library provides APIs to be used by the controller that can operate in endpoint mode. It also provides APIs to be used by function driver/library in order to implement a particular endpoint function.}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK"hjhhubh)}(hhh](h)}(h"APIs for the PCI controller Driverh]h"APIs for the PCI controller Driver}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj;hhhhhK'ubh)}(hhThis section lists the APIs that the PCI Endpoint core provides to be used by the PCI controller driver.h]hhThis section lists the APIs that the PCI Endpoint core provides to be used by the PCI controller driver.}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK)hj;hhubh bullet_list)}(hhh](h list_item)}(hXdevm_pci_epc_create()/pci_epc_create() The PCI controller driver should implement the following ops: * write_header: ops to populate configuration space header * set_bar: ops to configure the BAR * clear_bar: ops to reset the BAR * alloc_addr_space: ops to allocate in PCI controller address space * free_addr_space: ops to free the allocated address space * raise_irq: ops to raise a legacy, MSI or MSI-X interrupt * start: ops to start the PCI link * stop: ops to stop the PCI link The PCI controller driver can then create a new EPC device by invoking devm_pci_epc_create()/pci_epc_create(). h](h)}(h&devm_pci_epc_create()/pci_epc_create()h]h&devm_pci_epc_create()/pci_epc_create()}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK,hjaubh block_quote)}(hX^The PCI controller driver should implement the following ops: * write_header: ops to populate configuration space header * set_bar: ops to configure the BAR * clear_bar: ops to reset the BAR * alloc_addr_space: ops to allocate in PCI controller address space * free_addr_space: ops to free the allocated address space * raise_irq: ops to raise a legacy, MSI or MSI-X interrupt * start: ops to start the PCI link * stop: ops to stop the PCI link The PCI controller driver can then create a new EPC device by invoking devm_pci_epc_create()/pci_epc_create(). h](h)}(h=The PCI controller driver should implement the following ops:h]h=The PCI controller driver should implement the following ops:}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hjuubjt)}(hX* write_header: ops to populate configuration space header * set_bar: ops to configure the BAR * clear_bar: ops to reset the BAR * alloc_addr_space: ops to allocate in PCI controller address space * free_addr_space: ops to free the allocated address space * raise_irq: ops to raise a legacy, MSI or MSI-X interrupt * start: ops to start the PCI link * stop: ops to stop the PCI link h]j[)}(hhh](j`)}(h8write_header: ops to populate configuration space headerh]h)}(hjh]h8write_header: ops to populate configuration space header}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK0hjubah}(h]h ]h"]h$]h&]uh1j_hjubj`)}(h!set_bar: ops to configure the BARh]h)}(hjh]h!set_bar: ops to configure the BAR}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK1hjubah}(h]h ]h"]h$]h&]uh1j_hjubj`)}(hclear_bar: ops to reset the BARh]h)}(hjh]hclear_bar: ops to reset the BAR}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK2hjubah}(h]h ]h"]h$]h&]uh1j_hjubj`)}(hAalloc_addr_space: ops to allocate in PCI controller address spaceh]h)}(hjh]hAalloc_addr_space: ops to allocate in PCI controller address space}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK3hjubah}(h]h ]h"]h$]h&]uh1j_hjubj`)}(h8free_addr_space: ops to free the allocated address spaceh]h)}(hjh]h8free_addr_space: ops to free the allocated address space}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK4hjubah}(h]h ]h"]h$]h&]uh1j_hjubj`)}(h8raise_irq: ops to raise a legacy, MSI or MSI-X interrupth]h)}(hjh]h8raise_irq: ops to raise a legacy, MSI or MSI-X interrupt}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK5hjubah}(h]h ]h"]h$]h&]uh1j_hjubj`)}(h start: ops to start the PCI linkh]h)}(hjh]h start: ops to start the PCI link}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK6hjubah}(h]h ]h"]h$]h&]uh1j_hjubj`)}(hstop: ops to stop the PCI link h]h)}(hstop: ops to stop the PCI linkh]hstop: ops to stop the PCI link}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK7hj/ubah}(h]h ]h"]h$]h&]uh1j_hjubeh}(h]h ]h"]h$]h&]bullet*uh1jZhhhK0hjubah}(h]h ]h"]h$]h&]uh1jshhhK0hjuubh)}(hnThe PCI controller driver can then create a new EPC device by invoking devm_pci_epc_create()/pci_epc_create().h]hnThe PCI controller driver can then create a new EPC device by invoking devm_pci_epc_create()/pci_epc_create().}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK9hjuubeh}(h]h ]h"]h$]h&]uh1jshhhK.hjaubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubj`)}(hpci_epc_destroy() The PCI controller driver can destroy the EPC device created by pci_epc_create() using pci_epc_destroy(). h](h)}(hpci_epc_destroy()h]hpci_epc_destroy()}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jshhhK>hjoubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubj`)}(hpci_epc_linkup() In order to notify all the function devices that the EPC device to which they are linked has established a link with the host, the PCI controller driver should invoke pci_epc_linkup(). h](h)}(hpci_epc_linkup()h]hpci_epc_linkup()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKAhjubjt)}(hIn order to notify all the function devices that the EPC device to which they are linked has established a link with the host, the PCI controller driver should invoke pci_epc_linkup(). h]h)}(hIn order to notify all the function devices that the EPC device to which they are linked has established a link with the host, the PCI controller driver should invoke pci_epc_linkup().h]hIn order to notify all the function devices that the EPC device to which they are linked has established a link with the host, the PCI controller driver should invoke pci_epc_linkup().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKChjubah}(h]h ]h"]h$]h&]uh1jshhhKChjubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubj`)}(h^pci_epc_mem_init() Initialize the pci_epc_mem structure used for allocating EPC addr space. h](h)}(hpci_epc_mem_init()h]hpci_epc_mem_init()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKGhjubjt)}(hIInitialize the pci_epc_mem structure used for allocating EPC addr space. h]h)}(hHInitialize the pci_epc_mem structure used for allocating EPC addr space.h]hHInitialize the pci_epc_mem structure used for allocating EPC addr space.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKIhjubah}(h]h ]h"]h$]h&]uh1jshhhKIhjubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubj`)}(h]pci_epc_mem_exit() Cleanup the pci_epc_mem structure allocated during pci_epc_mem_init(). h](h)}(hpci_epc_mem_exit()h]hpci_epc_mem_exit()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKKhjubjt)}(hHCleanup the pci_epc_mem structure allocated during pci_epc_mem_init(). h]h)}(hFCleanup the pci_epc_mem structure allocated during pci_epc_mem_init().h]hFCleanup the pci_epc_mem structure allocated during pci_epc_mem_init().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKMhjubah}(h]h ]h"]h$]h&]uh1jshhhKMhjubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubeh}(h]h ]h"]h$]h&]jMjNuh1jZhhhK,hj;hhubeh}(h]"apis-for-the-pci-controller-driverah ]h"]"apis for the pci controller driverah$]h&]uh1hhjhhhhhK'ubh)}(hhh](h)}(h-EPC APIs for the PCI Endpoint Function Driverh]h-EPC APIs for the PCI Endpoint Function Driver}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj=hhhhhKQubh)}(hoThis section lists the APIs that the PCI Endpoint core provides to be used by the PCI endpoint function driver.h]hoThis section lists the APIs that the PCI Endpoint core provides to be used by the PCI endpoint function driver.}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKShj=hhubj[)}(hhh](j`)}(hpci_epc_write_header() The PCI endpoint function driver should use pci_epc_write_header() to write the standard configuration header to the endpoint controller. h](h)}(hpci_epc_write_header()h]hpci_epc_write_header()}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKVhj_ubjt)}(hThe PCI endpoint function driver should use pci_epc_write_header() to write the standard configuration header to the endpoint controller. h]h)}(hThe PCI endpoint function driver should use pci_epc_write_header() to write the standard configuration header to the endpoint controller.h]hThe PCI endpoint function driver should use pci_epc_write_header() to write the standard configuration header to the endpoint controller.}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKXhjqubah}(h]h ]h"]h$]h&]uh1jshhhKXhj_ubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubj`)}(hpci_epc_set_bar() The PCI endpoint function driver should use pci_epc_set_bar() to configure the Base Address Register in order for the host to assign PCI addr space. Register space of the function driver is usually configured using this API. h](h)}(hpci_epc_set_bar()h]hpci_epc_set_bar()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK[hjubjt)}(hThe PCI endpoint function driver should use pci_epc_set_bar() to configure the Base Address Register in order for the host to assign PCI addr space. Register space of the function driver is usually configured using this API. h]h)}(hThe PCI endpoint function driver should use pci_epc_set_bar() to configure the Base Address Register in order for the host to assign PCI addr space. Register space of the function driver is usually configured using this API.h]hThe PCI endpoint function driver should use pci_epc_set_bar() to configure the Base Address Register in order for the host to assign PCI addr space. Register space of the function driver is usually configured using this API.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK]hjubah}(h]h ]h"]h$]h&]uh1jshhhK]hjubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubj`)}(hipci_epc_clear_bar() The PCI endpoint function driver should use pci_epc_clear_bar() to reset the BAR. h](h)}(hpci_epc_clear_bar()h]hpci_epc_clear_bar()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKbhjubjt)}(hRThe PCI endpoint function driver should use pci_epc_clear_bar() to reset the BAR. h]h)}(hQThe PCI endpoint function driver should use pci_epc_clear_bar() to reset the BAR.h]hQThe PCI endpoint function driver should use pci_epc_clear_bar() to reset the BAR.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKdhjubah}(h]h ]h"]h$]h&]uh1jshhhKdhjubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubj`)}(hpci_epc_raise_irq() The PCI endpoint function driver should use pci_epc_raise_irq() to raise Legacy Interrupt, MSI or MSI-X Interrupt. h](h)}(hpci_epc_raise_irq()h]hpci_epc_raise_irq()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKghjubjt)}(hsThe PCI endpoint function driver should use pci_epc_raise_irq() to raise Legacy Interrupt, MSI or MSI-X Interrupt. h]h)}(hrThe PCI endpoint function driver should use pci_epc_raise_irq() to raise Legacy Interrupt, MSI or MSI-X Interrupt.h]hrThe PCI endpoint function driver should use pci_epc_raise_irq() to raise Legacy Interrupt, MSI or MSI-X Interrupt.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKihjubah}(h]h ]h"]h$]h&]uh1jshhhKihjubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubj`)}(hpci_epc_mem_alloc_addr() The PCI endpoint function driver should use pci_epc_mem_alloc_addr(), to allocate memory address from EPC addr space which is required to access RC's buffer h](h)}(hpci_epc_mem_alloc_addr()h]hpci_epc_mem_alloc_addr()}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKlhjubjt)}(hThe PCI endpoint function driver should use pci_epc_mem_alloc_addr(), to allocate memory address from EPC addr space which is required to access RC's buffer h]h)}(hThe PCI endpoint function driver should use pci_epc_mem_alloc_addr(), to allocate memory address from EPC addr space which is required to access RC's bufferh]hThe PCI endpoint function driver should use pci_epc_mem_alloc_addr(), to allocate memory address from EPC addr space which is required to access RC’s buffer}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKnhj1ubah}(h]h ]h"]h$]h&]uh1jshhhKnhjubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubj`)}(hpci_epc_mem_free_addr() The PCI endpoint function driver should use pci_epc_mem_free_addr() to free the memory space allocated using pci_epc_mem_alloc_addr(). h](h)}(hpci_epc_mem_free_addr()h]hpci_epc_mem_free_addr()}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKrhjOubjt)}(hThe PCI endpoint function driver should use pci_epc_mem_free_addr() to free the memory space allocated using pci_epc_mem_alloc_addr(). h]h)}(hThe PCI endpoint function driver should use pci_epc_mem_free_addr() to free the memory space allocated using pci_epc_mem_alloc_addr().h]hThe PCI endpoint function driver should use pci_epc_mem_free_addr() to free the memory space allocated using pci_epc_mem_alloc_addr().}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKthjaubah}(h]h ]h"]h$]h&]uh1jshhhKthjOubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubj`)}(hpci_epc_map_addr() A PCI endpoint function driver should use pci_epc_map_addr() to map to a RC PCI address the CPU address of local memory obtained with pci_epc_mem_alloc_addr(). h](h)}(hpci_epc_map_addr()h]hpci_epc_map_addr()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKwhjubh)}(hA PCI endpoint function driver should use pci_epc_map_addr() to map to a RC PCI address the CPU address of local memory obtained with pci_epc_mem_alloc_addr().h]hA PCI endpoint function driver should use pci_epc_map_addr() to map to a RC PCI address the CPU address of local memory obtained with pci_epc_mem_alloc_addr().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKyhjubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubj`)}(hpci_epc_unmap_addr() A PCI endpoint function driver should use pci_epc_unmap_addr() to unmap the CPU address of local memory mapped to a RC address with pci_epc_map_addr(). h](h)}(hpci_epc_unmap_addr()h]hpci_epc_unmap_addr()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK}hjubh)}(hA PCI endpoint function driver should use pci_epc_unmap_addr() to unmap the CPU address of local memory mapped to a RC address with pci_epc_map_addr().h]hA PCI endpoint function driver should use pci_epc_unmap_addr() to unmap the CPU address of local memory mapped to a RC address with pci_epc_map_addr().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubj`)}(hXpci_epc_mem_map() A PCI endpoint controller may impose constraints on the RC PCI addresses that can be mapped. The function pci_epc_mem_map() allows endpoint function drivers to allocate and map controller memory while handling such constraints. This function will determine the size of the memory that must be allocated with pci_epc_mem_alloc_addr() for successfully mapping a RC PCI address range. This function will also indicate the size of the PCI address range that was actually mapped, which can be less than the requested size, as well as the offset into the allocated memory to use for accessing the mapped RC PCI address range. h](h)}(hpci_epc_mem_map()h]hpci_epc_mem_map()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hXkA PCI endpoint controller may impose constraints on the RC PCI addresses that can be mapped. The function pci_epc_mem_map() allows endpoint function drivers to allocate and map controller memory while handling such constraints. This function will determine the size of the memory that must be allocated with pci_epc_mem_alloc_addr() for successfully mapping a RC PCI address range. This function will also indicate the size of the PCI address range that was actually mapped, which can be less than the requested size, as well as the offset into the allocated memory to use for accessing the mapped RC PCI address range.h]hXkA PCI endpoint controller may impose constraints on the RC PCI addresses that can be mapped. The function pci_epc_mem_map() allows endpoint function drivers to allocate and map controller memory while handling such constraints. This function will determine the size of the memory that must be allocated with pci_epc_mem_alloc_addr() for successfully mapping a RC PCI address range. This function will also indicate the size of the PCI address range that was actually mapped, which can be less than the requested size, as well as the offset into the allocated memory to use for accessing the mapped RC PCI address range.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubj`)}(hpci_epc_mem_unmap() A PCI endpoint function driver can use pci_epc_mem_unmap() to unmap and free controller memory that was allocated and mapped using pci_epc_mem_map(). h](h)}(hpci_epc_mem_unmap()h]hpci_epc_mem_unmap()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hA PCI endpoint function driver can use pci_epc_mem_unmap() to unmap and free controller memory that was allocated and mapped using pci_epc_mem_map().h]hA PCI endpoint function driver can use pci_epc_mem_unmap() to unmap and free controller memory that was allocated and mapped using pci_epc_mem_map().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1j_hj\hhhhhNubeh}(h]h ]h"]h$]h&]jMjNuh1jZhhhKVhj=hhubeh}(h]-epc-apis-for-the-pci-endpoint-function-driverah ]h"]-epc apis for the pci endpoint function driverah$]h&]uh1hhjhhhhhKQubh)}(hhh](h)}(hOther EPC APIsh]hOther EPC APIs}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj%hhhhhKubh)}(hThere are other APIs provided by the EPC library. These are used for binding the EPF device with EPC device. pci-ep-cfs.c can be used as reference for using these APIs.h]hThere are other APIs provided by the EPC library. These are used for binding the EPF device with EPC device. pci-ep-cfs.c can be used as reference for using these APIs.}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj%hhubj[)}(hhh](j`)}(hlpci_epc_get() Get a reference to the PCI endpoint controller based on the device name of the controller. h](h)}(h pci_epc_get()h]h pci_epc_get()}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjGubjt)}(h[Get a reference to the PCI endpoint controller based on the device name of the controller. h]h)}(hZGet a reference to the PCI endpoint controller based on the device name of the controller.h]hZGet a reference to the PCI endpoint controller based on the device name of the controller.}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjYubah}(h]h ]h"]h$]h&]uh1jshhhKhjGubeh}(h]h ]h"]h$]h&]uh1j_hjDhhhhhNubj`)}(hcpci_epc_put() Release the reference to the PCI endpoint controller obtained using pci_epc_get() h](h)}(h pci_epc_put()h]h pci_epc_put()}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjwubjt)}(hRRelease the reference to the PCI endpoint controller obtained using pci_epc_get() h]h)}(hQRelease the reference to the PCI endpoint controller obtained using pci_epc_get()h]hQRelease the reference to the PCI endpoint controller obtained using pci_epc_get()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jshhhKhjwubeh}(h]h ]h"]h$]h&]uh1j_hjDhhhhhNubj`)}(hpci_epc_add_epf() Add a PCI endpoint function to a PCI endpoint controller. A PCIe device can have up to 8 functions according to the specification. h](h)}(hpci_epc_add_epf()h]hpci_epc_add_epf()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubjt)}(hAdd a PCI endpoint function to a PCI endpoint controller. A PCIe device can have up to 8 functions according to the specification. h]h)}(hAdd a PCI endpoint function to a PCI endpoint controller. A PCIe device can have up to 8 functions according to the specification.h]hAdd a PCI endpoint function to a PCI endpoint controller. A PCIe device can have up to 8 functions according to the specification.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jshhhKhjubeh}(h]h ]h"]h$]h&]uh1j_hjDhhhhhNubj`)}(hVpci_epc_remove_epf() Remove the PCI endpoint function from PCI endpoint controller. h](h)}(hpci_epc_remove_epf()h]hpci_epc_remove_epf()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubjt)}(h?Remove the PCI endpoint function from PCI endpoint controller. h]h)}(h>Remove the PCI endpoint function from PCI endpoint controller.h]h>Remove the PCI endpoint function from PCI endpoint controller.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jshhhKhjubeh}(h]h ]h"]h$]h&]uh1j_hjDhhhhhNubj`)}(hpci_epc_start() The PCI endpoint function driver should invoke pci_epc_start() once it has configured the endpoint function and wants to start the PCI link. h](h)}(hpci_epc_start()h]hpci_epc_start()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubjt)}(hThe PCI endpoint function driver should invoke pci_epc_start() once it has configured the endpoint function and wants to start the PCI link. h]h)}(hThe PCI endpoint function driver should invoke pci_epc_start() once it has configured the endpoint function and wants to start the PCI link.h]hThe PCI endpoint function driver should invoke pci_epc_start() once it has configured the endpoint function and wants to start the PCI link.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jshhhKhjubeh}(h]h ]h"]h$]h&]uh1j_hjDhhhhhNubj`)}(hgpci_epc_stop() The PCI endpoint function driver should invoke pci_epc_stop() to stop the PCI LINK. h](h)}(hpci_epc_stop()h]hpci_epc_stop()}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj7ubjt)}(hUThe PCI endpoint function driver should invoke pci_epc_stop() to stop the PCI LINK. h]h)}(hSThe PCI endpoint function driver should invoke pci_epc_stop() to stop the PCI LINK.h]hSThe PCI endpoint function driver should invoke pci_epc_stop() to stop the PCI LINK.}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjIubah}(h]h ]h"]h$]h&]uh1jshhhKhj7ubeh}(h]h ]h"]h$]h&]uh1j_hjDhhhhhNubeh}(h]h ]h"]h$]h&]jMjNuh1jZhhhKhj%hhubeh}(h]other-epc-apisah ]h"]other epc apisah$]h&]uh1hhjhhhhhKubeh}(h]#pci-endpoint-controller-epc-libraryah ]h"]$pci endpoint controller(epc) libraryah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(h"PCI Endpoint Function(EPF) Libraryh]h"PCI Endpoint Function(EPF) Library}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj}hhhhhKubh)}(h{The EPF library provides APIs to be used by the function driver and the EPC library to provide endpoint mode functionality.h]h{The EPF library provides APIs to be used by the function driver and the EPC library to provide endpoint mode functionality.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj}hhubh)}(hhh](h)}(h-EPF APIs for the PCI Endpoint Function Driverh]h-EPF APIs for the PCI Endpoint Function Driver}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hoThis section lists the APIs that the PCI Endpoint core provides to be used by the PCI endpoint function driver.h]hoThis section lists the APIs that the PCI Endpoint core provides to be used by the PCI endpoint function driver.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj[)}(hhh](j`)}(hXpci_epf_register_driver() The PCI Endpoint Function driver should implement the following ops: * bind: ops to perform when a EPC device has been bound to EPF device * unbind: ops to perform when a binding has been lost between a EPC device and EPF device * add_cfs: optional ops to create function specific configfs attributes The PCI Function driver can then register the PCI EPF driver by using pci_epf_register_driver(). h](h)}(hpci_epf_register_driver()h]hpci_epf_register_driver()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubjt)}(hXOThe PCI Endpoint Function driver should implement the following ops: * bind: ops to perform when a EPC device has been bound to EPF device * unbind: ops to perform when a binding has been lost between a EPC device and EPF device * add_cfs: optional ops to create function specific configfs attributes h]hdefinition_list)}(hhh]hdefinition_list_item)}(hX1The PCI Endpoint Function driver should implement the following ops: * bind: ops to perform when a EPC device has been bound to EPF device * unbind: ops to perform when a binding has been lost between a EPC device and EPF device * add_cfs: optional ops to create function specific configfs attributes h](hterm)}(hDThe PCI Endpoint Function driver should implement the following ops:h]hDThe PCI Endpoint Function driver should implement the following ops:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhKhjubh definition)}(hhh]j[)}(hhh](j`)}(hCbind: ops to perform when a EPC device has been bound to EPF deviceh]h)}(hjh]hCbind: ops to perform when a EPC device has been bound to EPF device}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j_hjubj`)}(hWunbind: ops to perform when a binding has been lost between a EPC device and EPF deviceh]h)}(hWunbind: ops to perform when a binding has been lost between a EPC device and EPF deviceh]hWunbind: ops to perform when a binding has been lost between a EPC device and EPF device}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j_hjubj`)}(hFadd_cfs: optional ops to create function specific configfs attributes h]h)}(hEadd_cfs: optional ops to create function specific configfs attributesh]hEadd_cfs: optional ops to create function specific configfs attributes}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj&ubah}(h]h ]h"]h$]h&]uh1j_hjubeh}(h]h ]h"]h$]h&]jMjNuh1jZhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jshhhKhjubh)}(h`The PCI Function driver can then register the PCI EPF driver by using pci_epf_register_driver().h]h`The PCI Function driver can then register the PCI EPF driver by using pci_epf_register_driver().}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1j_hjhhhhhNubj`)}(h}pci_epf_unregister_driver() The PCI Function driver can unregister the PCI EPF driver by using pci_epf_unregister_driver(). h](h)}(hpci_epf_unregister_driver()h]hpci_epf_unregister_driver()}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjpubh)}(h_The PCI Function driver can unregister the PCI EPF driver by using pci_epf_unregister_driver().h]h_The PCI Function driver can unregister the PCI EPF driver by using pci_epf_unregister_driver().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjpubeh}(h]h ]h"]h$]h&]uh1j_hjhhhhhNubj`)}(htpci_epf_alloc_space() The PCI Function driver can allocate space for a particular BAR using pci_epf_alloc_space(). h](h)}(hpci_epf_alloc_space()h]hpci_epf_alloc_space()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(h\The PCI Function driver can allocate space for a particular BAR using pci_epf_alloc_space().h]h\The PCI Function driver can allocate space for a particular BAR using pci_epf_alloc_space().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1j_hjhhhhhNubj`)}(hpci_epf_free_space() The PCI Function driver can free the allocated space (using pci_epf_alloc_space) by invoking pci_epf_free_space(). h](h)}(hpci_epf_free_space()h]hpci_epf_free_space()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hrThe PCI Function driver can free the allocated space (using pci_epf_alloc_space) by invoking pci_epf_free_space().h]hrThe PCI Function driver can free the allocated space (using pci_epf_alloc_space) by invoking pci_epf_free_space().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1j_hjhhhhhNubeh}(h]h ]h"]h$]h&]jMjNuh1jZhhhKhjhhubeh}(h]-epf-apis-for-the-pci-endpoint-function-driverah ]h"]-epf apis for the pci endpoint function driverah$]h&]uh1hhj}hhhhhKubh)}(hhh](h)}(h,APIs for the PCI Endpoint Controller Libraryh]h,APIs for the PCI Endpoint Controller Library}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hrThis section lists the APIs that the PCI Endpoint core provides to be used by the PCI endpoint controller library.h]hrThis section lists the APIs that the PCI Endpoint core provides to be used by the PCI endpoint controller library.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj[)}(hhh]j`)}(hpci_epf_linkup() The PCI endpoint controller library invokes pci_epf_linkup() when the EPC device has established the connection to the host. h](h)}(hpci_epf_linkup()h]hpci_epf_linkup()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubjt)}(h}The PCI endpoint controller library invokes pci_epf_linkup() when the EPC device has established the connection to the host. h]h)}(h|The PCI endpoint controller library invokes pci_epf_linkup() when the EPC device has established the connection to the host.h]h|The PCI endpoint controller library invokes pci_epf_linkup() when the EPC device has established the connection to the host.}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj$ubah}(h]h ]h"]h$]h&]uh1jshhhKhjubeh}(h]h ]h"]h$]h&]uh1j_hjhhhhhNubah}(h]h ]h"]h$]h&]jMjNuh1jZhhhKhjhhubeh}(h],apis-for-the-pci-endpoint-controller-libraryah ]h"],apis for the pci endpoint controller libraryah$]h&]uh1hhj}hhhhhKubh)}(hhh](h)}(hOther EPF APIsh]hOther EPF APIs}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhjPhhhhhKubh)}(hThere are other APIs provided by the EPF library. These are used to notify the function driver when the EPF device is bound to the EPC device. pci-ep-cfs.c can be used as reference for using these APIs.h]hThere are other APIs provided by the EPF library. These are used to notify the function driver when the EPF device is bound to the EPC device. pci-ep-cfs.c can be used as reference for using these APIs.}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjPhhubj[)}(hhh](j`)}(hpci_epf_create() Create a new PCI EPF device by passing the name of the PCI EPF device. This name will be used to bind the EPF device to a EPF driver. h](h)}(hpci_epf_create()h]hpci_epf_create()}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjrubjt)}(hCreate a new PCI EPF device by passing the name of the PCI EPF device. This name will be used to bind the EPF device to a EPF driver. h]h)}(hCreate a new PCI EPF device by passing the name of the PCI EPF device. This name will be used to bind the EPF device to a EPF driver.h]hCreate a new PCI EPF device by passing the name of the PCI EPF device. This name will be used to bind the EPF device to a EPF driver.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jshhhKhjrubeh}(h]h ]h"]h$]h&]uh1j_hjohhhhhNubj`)}(h8pci_epf_destroy() Destroy the created PCI EPF device. h](h)}(hpci_epf_destroy()h]hpci_epf_destroy()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubjt)}(h$Destroy the created PCI EPF device. h]h)}(h#Destroy the created PCI EPF device.h]h#Destroy the created PCI EPF device.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jshhhKhjubeh}(h]h ]h"]h$]h&]uh1j_hjohhhhhNubj`)}(hgpci_epf_bind() pci_epf_bind() should be invoked when the EPF device has been bound to a EPC device. h](h)}(hpci_epf_bind()h]hpci_epf_bind()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubjt)}(hUpci_epf_bind() should be invoked when the EPF device has been bound to a EPC device. h]h)}(hTpci_epf_bind() should be invoked when the EPF device has been bound to a EPC device.h]hTpci_epf_bind() should be invoked when the EPF device has been bound to a EPC device.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jshhhKhjubeh}(h]h ]h"]h$]h&]uh1j_hjohhhhhNubj`)}(hrpci_epf_unbind() pci_epf_unbind() should be invoked when the binding between EPC device and EPF device is lost.h](h)}(hpci_epf_unbind()h]hpci_epf_unbind()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubjt)}(h^pci_epf_unbind() should be invoked when the binding between EPC device and EPF device is lost.h]h)}(h^pci_epf_unbind() should be invoked when the binding between EPC device and EPF device is lost.h]h^pci_epf_unbind() should be invoked when the binding between EPC device and EPF device is lost.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jshhhMhj ubeh}(h]h ]h"]h$]h&]uh1j_hjohhhhhNubeh}(h]h ]h"]h$]h&]jMjNuh1jZhhhKhjPhhubeh}(h]other-epf-apisah ]h"]other epf apisah$]h&]uh1hhj}hhhhhKubeh}(h]!pci-endpoint-function-epf-libraryah ]h"]"pci endpoint function(epf) libraryah$]h&]uh1hhhhhhhhKubeh}(h]pci-endpoint-coreah ]h"]pci endpoint coreah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjs error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(hhjM jJ jzjwj:j7j"jjrjojE jB jjjMjJj= j: u nametypes}(hjM jzj:j"jrjE jjMj= uh}(hhjJ hjwjj7j;jj=joj%jB j}jjjJjj: jPu footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.