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

Documentation: PCI: convert PCIEBUS-HOWTO.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
2e642244 229b4e07

+82 -59
+81 -59
Documentation/PCI/PCIEBUS-HOWTO.txt Documentation/PCI/picebus-howto.rst
··· 1 - The PCI Express Port Bus Driver Guide HOWTO 2 - Tom L Nguyen tom.l.nguyen@intel.com 3 - 11/03/2004 1 + .. SPDX-License-Identifier: GPL-2.0 2 + .. include:: <isonum.txt> 4 3 5 - 1. About this guide 4 + =========================================== 5 + The PCI Express Port Bus Driver Guide HOWTO 6 + =========================================== 7 + 8 + :Author: Tom L Nguyen tom.l.nguyen@intel.com 11/03/2004 9 + :Copyright: |copy| 2004 Intel Corporation 10 + 11 + About this guide 12 + ================ 6 13 7 14 This guide describes the basics of the PCI Express Port Bus driver 8 15 and provides information on how to enable the service drivers to 9 16 register/unregister with the PCI Express Port Bus Driver. 10 17 11 - 2. Copyright 2004 Intel Corporation 12 18 13 - 3. What is the PCI Express Port Bus Driver 19 + What is the PCI Express Port Bus Driver 20 + ======================================= 14 21 15 22 A PCI Express Port is a logical PCI-PCI Bridge structure. There 16 23 are two types of PCI Express Port: the Root Port and the Switch ··· 37 30 be handled by a single complex driver or be individually distributed 38 31 and handled by corresponding service drivers. 39 32 40 - 4. Why use the PCI Express Port Bus Driver? 33 + Why use the PCI Express Port Bus Driver? 34 + ======================================== 41 35 42 36 In existing Linux kernels, the Linux Device Driver Model allows a 43 37 physical device to be handled by only a single driver. The PCI ··· 59 51 to the corresponding service drivers as required. Some key 60 52 advantages of using the PCI Express Port Bus driver are listed below: 61 53 62 - - Allow multiple service drivers to run simultaneously on 63 - a PCI-PCI Bridge Port device. 54 + - Allow multiple service drivers to run simultaneously on 55 + a PCI-PCI Bridge Port device. 64 56 65 - - Allow service drivers implemented in an independent 66 - staged approach. 57 + - Allow service drivers implemented in an independent 58 + staged approach. 67 59 68 - - Allow one service driver to run on multiple PCI-PCI Bridge 69 - Port devices. 60 + - Allow one service driver to run on multiple PCI-PCI Bridge 61 + Port devices. 70 62 71 - - Manage and distribute resources of a PCI-PCI Bridge Port 72 - device to requested service drivers. 63 + - Manage and distribute resources of a PCI-PCI Bridge Port 64 + device to requested service drivers. 73 65 74 - 5. Configuring the PCI Express Port Bus Driver vs. Service Drivers 66 + Configuring the PCI Express Port Bus Driver vs. Service Drivers 67 + =============================================================== 75 68 76 - 5.1 Including the PCI Express Port Bus Driver Support into the Kernel 69 + Including the PCI Express Port Bus Driver Support into the Kernel 70 + ----------------------------------------------------------------- 77 71 78 72 Including the PCI Express Port Bus driver depends on whether the PCI 79 73 Express support is included in the kernel config. The kernel will 80 74 automatically include the PCI Express Port Bus driver as a kernel 81 75 driver when the PCI Express support is enabled in the kernel. 82 76 83 - 5.2 Enabling Service Driver Support 77 + Enabling Service Driver Support 78 + ------------------------------- 84 79 85 80 PCI device drivers are implemented based on Linux Device Driver Model. 86 81 All service drivers are PCI device drivers. As discussed above, it is ··· 100 89 Failure to do so will result an identity mismatch, which prevents 101 90 the PCI Express Port Bus driver from loading a service driver. 102 91 103 - 5.2.1 pcie_port_service_register 92 + pcie_port_service_register 93 + ~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 + :: 104 95 105 - int pcie_port_service_register(struct pcie_port_service_driver *new) 96 + int pcie_port_service_register(struct pcie_port_service_driver *new) 106 97 107 98 This API replaces the Linux Driver Model's pci_register_driver API. A 108 99 service driver should always calls pcie_port_service_register at ··· 112 99 such as pci_enable_device(dev) and pci_set_master(dev) are no longer 113 100 necessary since these calls are executed by the PCI Port Bus driver. 114 101 115 - 5.2.2 pcie_port_service_unregister 102 + pcie_port_service_unregister 103 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 + :: 116 105 117 - void pcie_port_service_unregister(struct pcie_port_service_driver *new) 106 + void pcie_port_service_unregister(struct pcie_port_service_driver *new) 118 107 119 108 pcie_port_service_unregister replaces the Linux Driver Model's 120 109 pci_unregister_driver. It's always called by service driver when a 121 110 module exits. 122 111 123 - 5.2.3 Sample Code 112 + Sample Code 113 + ~~~~~~~~~~~ 124 114 125 115 Below is sample service driver code to initialize the port service 126 116 driver data structure. 117 + :: 127 118 128 - static struct pcie_port_service_id service_id[] = { { 129 - .vendor = PCI_ANY_ID, 130 - .device = PCI_ANY_ID, 131 - .port_type = PCIE_RC_PORT, 132 - .service_type = PCIE_PORT_SERVICE_AER, 133 - }, { /* end: all zeroes */ } 134 - }; 119 + static struct pcie_port_service_id service_id[] = { { 120 + .vendor = PCI_ANY_ID, 121 + .device = PCI_ANY_ID, 122 + .port_type = PCIE_RC_PORT, 123 + .service_type = PCIE_PORT_SERVICE_AER, 124 + }, { /* end: all zeroes */ } 125 + }; 135 126 136 - static struct pcie_port_service_driver root_aerdrv = { 137 - .name = (char *)device_name, 138 - .id_table = &service_id[0], 127 + static struct pcie_port_service_driver root_aerdrv = { 128 + .name = (char *)device_name, 129 + .id_table = &service_id[0], 139 130 140 - .probe = aerdrv_load, 141 - .remove = aerdrv_unload, 131 + .probe = aerdrv_load, 132 + .remove = aerdrv_unload, 142 133 143 - .suspend = aerdrv_suspend, 144 - .resume = aerdrv_resume, 145 - }; 134 + .suspend = aerdrv_suspend, 135 + .resume = aerdrv_resume, 136 + }; 146 137 147 138 Below is a sample code for registering/unregistering a service 148 139 driver. 140 + :: 149 141 150 - static int __init aerdrv_service_init(void) 151 - { 152 - int retval = 0; 142 + static int __init aerdrv_service_init(void) 143 + { 144 + int retval = 0; 153 145 154 - retval = pcie_port_service_register(&root_aerdrv); 155 - if (!retval) { 156 - /* 157 - * FIX ME 158 - */ 159 - } 160 - return retval; 161 - } 146 + retval = pcie_port_service_register(&root_aerdrv); 147 + if (!retval) { 148 + /* 149 + * FIX ME 150 + */ 151 + } 152 + return retval; 153 + } 162 154 163 - static void __exit aerdrv_service_exit(void) 164 - { 165 - pcie_port_service_unregister(&root_aerdrv); 166 - } 155 + static void __exit aerdrv_service_exit(void) 156 + { 157 + pcie_port_service_unregister(&root_aerdrv); 158 + } 167 159 168 - module_init(aerdrv_service_init); 169 - module_exit(aerdrv_service_exit); 160 + module_init(aerdrv_service_init); 161 + module_exit(aerdrv_service_exit); 170 162 171 - 6. Possible Resource Conflicts 163 + Possible Resource Conflicts 164 + =========================== 172 165 173 166 Since all service drivers of a PCI-PCI Bridge Port device are 174 167 allowed to run simultaneously, below lists a few of possible resource 175 168 conflicts with proposed solutions. 176 169 177 - 6.1 MSI and MSI-X Vector Resource 170 + MSI and MSI-X Vector Resource 171 + ----------------------------- 178 172 179 173 Once MSI or MSI-X interrupts are enabled on a device, it stays in this 180 174 mode until they are disabled again. Since service drivers of the same ··· 199 179 call request_irq/free_irq. In addition, the interrupt mode is stored 200 180 in the field interrupt_mode of struct pcie_device. 201 181 202 - 6.3 PCI Memory/IO Mapped Regions 182 + PCI Memory/IO Mapped Regions 183 + ---------------------------- 203 184 204 185 Service drivers for PCI Express Power Management (PME), Advanced 205 186 Error Reporting (AER), Hot-Plug (HP) and Virtual Channel (VC) access ··· 209 188 that all service drivers will be well behaved and not overwrite 210 189 other service driver's configuration settings. 211 190 212 - 6.4 PCI Config Registers 191 + PCI Config Registers 192 + -------------------- 213 193 214 194 Each service driver runs its PCI config operations on its own 215 195 capability structure except the PCI Express capability structure, in
+1
Documentation/PCI/index.rst
··· 9 9 :numbered: 10 10 11 11 pci 12 + picebus-howto