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

pnp.txt: standardize document format

Each text file under Documentation follows a different
format. Some doesn't even have titles!

Change its representation to follow the adopted standard,
using ReST markups for it to be parseable by Sphinx:

- Use a markup for document title;
- use :Author: and :Last updated: for authorship;
- adjust whitespaces where needed;
- mark literal blocks;
- fix a few subtitle markups.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
9a4aa7bf 5da98b82

+177 -136
+177 -136
Documentation/pnp.txt
··· 1 + ================================= 1 2 Linux Plug and Play Documentation 2 - by Adam Belay <ambx1@neo.rr.com> 3 - last updated: Oct. 16, 2002 4 - --------------------------------------------------------------------------------------- 3 + ================================= 5 4 5 + :Author: Adam Belay <ambx1@neo.rr.com> 6 + :Last updated: Oct. 16, 2002 6 7 7 8 8 9 Overview 9 10 -------- 10 - Plug and Play provides a means of detecting and setting resources for legacy or 11 + 12 + Plug and Play provides a means of detecting and setting resources for legacy or 11 13 otherwise unconfigurable devices. The Linux Plug and Play Layer provides these 12 14 services to compatible drivers. 13 15 14 16 15 - 16 17 The User Interface 17 18 ------------------ 18 - The Linux Plug and Play user interface provides a means to activate PnP devices 19 + 20 + The Linux Plug and Play user interface provides a means to activate PnP devices 19 21 for legacy and user level drivers that do not support Linux Plug and Play. The 20 22 user interface is integrated into sysfs. 21 23 22 24 In addition to the standard sysfs file the following are created in each 23 25 device's directory: 24 - id - displays a list of support EISA IDs 25 - options - displays possible resource configurations 26 - resources - displays currently allocated resources and allows resource changes 26 + - id - displays a list of support EISA IDs 27 + - options - displays possible resource configurations 28 + - resources - displays currently allocated resources and allows resource changes 27 29 28 - -activating a device 30 + activating a device 31 + ^^^^^^^^^^^^^^^^^^^ 29 32 30 - #echo "auto" > resources 33 + :: 34 + 35 + # echo "auto" > resources 31 36 32 37 this will invoke the automatic resource config system to activate the device 33 38 34 - -manually activating a device 39 + manually activating a device 40 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 35 41 36 - #echo "manual <depnum> <mode>" > resources 37 - <depnum> - the configuration number 38 - <mode> - static or dynamic 39 - static = for next boot 40 - dynamic = now 42 + :: 41 43 42 - -disabling a device 44 + # echo "manual <depnum> <mode>" > resources 43 45 44 - #echo "disable" > resources 46 + <depnum> - the configuration number 47 + <mode> - static or dynamic 48 + static = for next boot 49 + dynamic = now 50 + 51 + disabling a device 52 + ^^^^^^^^^^^^^^^^^^ 53 + 54 + :: 55 + 56 + # echo "disable" > resources 45 57 46 58 47 59 EXAMPLE: 48 60 49 61 Suppose you need to activate the floppy disk controller. 50 - 1.) change to the proper directory, in my case it is 51 - /driver/bus/pnp/devices/00:0f 52 - # cd /driver/bus/pnp/devices/00:0f 53 - # cat name 54 - PC standard floppy disk controller 55 62 56 - 2.) check if the device is already active 57 - # cat resources 58 - DISABLED 63 + 1. change to the proper directory, in my case it is 64 + /driver/bus/pnp/devices/00:0f:: 59 65 60 - - Notice the string "DISABLED". This means the device is not active. 66 + # cd /driver/bus/pnp/devices/00:0f 67 + # cat name 68 + PC standard floppy disk controller 61 69 62 - 3.) check the device's possible configurations (optional) 63 - # cat options 64 - Dependent: 01 - Priority acceptable 65 - port 0x3f0-0x3f0, align 0x7, size 0x6, 16-bit address decoding 66 - port 0x3f7-0x3f7, align 0x0, size 0x1, 16-bit address decoding 67 - irq 6 68 - dma 2 8-bit compatible 69 - Dependent: 02 - Priority acceptable 70 - port 0x370-0x370, align 0x7, size 0x6, 16-bit address decoding 71 - port 0x377-0x377, align 0x0, size 0x1, 16-bit address decoding 72 - irq 6 73 - dma 2 8-bit compatible 70 + 2. check if the device is already active:: 74 71 75 - 4.) now activate the device 76 - # echo "auto" > resources 72 + # cat resources 73 + DISABLED 77 74 78 - 5.) finally check if the device is active 79 - # cat resources 80 - io 0x3f0-0x3f5 81 - io 0x3f7-0x3f7 82 - irq 6 83 - dma 2 75 + - Notice the string "DISABLED". This means the device is not active. 84 76 85 - also there are a series of kernel parameters: 86 - pnp_reserve_irq=irq1[,irq2] .... 87 - pnp_reserve_dma=dma1[,dma2] .... 88 - pnp_reserve_io=io1,size1[,io2,size2] .... 89 - pnp_reserve_mem=mem1,size1[,mem2,size2] .... 77 + 3. check the device's possible configurations (optional):: 78 + 79 + # cat options 80 + Dependent: 01 - Priority acceptable 81 + port 0x3f0-0x3f0, align 0x7, size 0x6, 16-bit address decoding 82 + port 0x3f7-0x3f7, align 0x0, size 0x1, 16-bit address decoding 83 + irq 6 84 + dma 2 8-bit compatible 85 + Dependent: 02 - Priority acceptable 86 + port 0x370-0x370, align 0x7, size 0x6, 16-bit address decoding 87 + port 0x377-0x377, align 0x0, size 0x1, 16-bit address decoding 88 + irq 6 89 + dma 2 8-bit compatible 90 + 91 + 4. now activate the device:: 92 + 93 + # echo "auto" > resources 94 + 95 + 5. finally check if the device is active:: 96 + 97 + # cat resources 98 + io 0x3f0-0x3f5 99 + io 0x3f7-0x3f7 100 + irq 6 101 + dma 2 102 + 103 + also there are a series of kernel parameters:: 104 + 105 + pnp_reserve_irq=irq1[,irq2] .... 106 + pnp_reserve_dma=dma1[,dma2] .... 107 + pnp_reserve_io=io1,size1[,io2,size2] .... 108 + pnp_reserve_mem=mem1,size1[,mem2,size2] .... 90 109 91 110 92 111 93 112 The Unified Plug and Play Layer 94 113 ------------------------------- 95 - All Plug and Play drivers, protocols, and services meet at a central location 114 + 115 + All Plug and Play drivers, protocols, and services meet at a central location 96 116 called the Plug and Play Layer. This layer is responsible for the exchange of 97 117 information between PnP drivers and PnP protocols. Thus it automatically 98 118 forwards commands to the proper protocol. This makes writing PnP drivers ··· 121 101 The following functions are available from the Plug and Play Layer: 122 102 123 103 pnp_get_protocol 124 - - increments the number of uses by one 104 + increments the number of uses by one 125 105 126 106 pnp_put_protocol 127 - - deincrements the number of uses by one 107 + deincrements the number of uses by one 128 108 129 109 pnp_register_protocol 130 - - use this to register a new PnP protocol 110 + use this to register a new PnP protocol 131 111 132 112 pnp_unregister_protocol 133 - - use this function to remove a PnP protocol from the Plug and Play Layer 113 + use this function to remove a PnP protocol from the Plug and Play Layer 134 114 135 115 pnp_register_driver 136 - - adds a PnP driver to the Plug and Play Layer 137 - - this includes driver model integration 138 - - returns zero for success or a negative error number for failure; count 116 + adds a PnP driver to the Plug and Play Layer 117 + 118 + this includes driver model integration 119 + returns zero for success or a negative error number for failure; count 139 120 calls to the .add() method if you need to know how many devices bind to 140 121 the driver 141 122 142 123 pnp_unregister_driver 143 - - removes a PnP driver from the Plug and Play Layer 124 + removes a PnP driver from the Plug and Play Layer 144 125 145 126 146 127 147 128 Plug and Play Protocols 148 129 ----------------------- 149 - This section contains information for PnP protocol developers. 130 + 131 + This section contains information for PnP protocol developers. 150 132 151 133 The following Protocols are currently available in the computing world: 152 - - PNPBIOS: used for system devices such as serial and parallel ports. 153 - - ISAPNP: provides PnP support for the ISA bus 154 - - ACPI: among its many uses, ACPI provides information about system level 155 - devices. 134 + 135 + - PNPBIOS: 136 + used for system devices such as serial and parallel ports. 137 + - ISAPNP: 138 + provides PnP support for the ISA bus 139 + - ACPI: 140 + among its many uses, ACPI provides information about system level 141 + devices. 142 + 156 143 It is meant to replace the PNPBIOS. It is not currently supported by Linux 157 144 Plug and Play but it is planned to be in the near future. 158 145 159 146 160 147 Requirements for a Linux PnP protocol: 161 - 1.) the protocol must use EISA IDs 162 - 2.) the protocol must inform the PnP Layer of a device's current configuration 148 + 1. the protocol must use EISA IDs 149 + 2. the protocol must inform the PnP Layer of a device's current configuration 150 + 163 151 - the ability to set resources is optional but preferred. 164 152 165 153 The following are PnP protocol related functions: 166 154 167 155 pnp_add_device 168 - - use this function to add a PnP device to the PnP layer 169 - - only call this function when all wanted values are set in the pnp_dev 170 - structure 156 + use this function to add a PnP device to the PnP layer 157 + 158 + only call this function when all wanted values are set in the pnp_dev 159 + structure 171 160 172 161 pnp_init_device 173 - - call this to initialize the PnP structure 162 + call this to initialize the PnP structure 174 163 175 164 pnp_remove_device 176 - - call this to remove a device from the Plug and Play Layer. 177 - - it will fail if the device is still in use. 178 - - automatically will free mem used by the device and related structures 165 + call this to remove a device from the Plug and Play Layer. 166 + it will fail if the device is still in use. 167 + automatically will free mem used by the device and related structures 179 168 180 169 pnp_add_id 181 - - adds an EISA ID to the list of supported IDs for the specified device 170 + adds an EISA ID to the list of supported IDs for the specified device 182 171 183 172 For more information consult the source of a protocol such as 184 173 /drivers/pnp/pnpbios/core.c. ··· 196 167 197 168 Linux Plug and Play Drivers 198 169 --------------------------- 199 - This section contains information for Linux PnP driver developers. 170 + 171 + This section contains information for Linux PnP driver developers. 200 172 201 173 The New Way 202 - ........... 203 - 1.) first make a list of supported EISA IDS 204 - ex: 205 - static const struct pnp_id pnp_dev_table[] = { 206 - /* Standard LPT Printer Port */ 207 - {.id = "PNP0400", .driver_data = 0}, 208 - /* ECP Printer Port */ 209 - {.id = "PNP0401", .driver_data = 0}, 210 - {.id = ""} 211 - }; 174 + ^^^^^^^^^^^ 212 175 213 - Please note that the character 'X' can be used as a wild card in the function 214 - portion (last four characters). 215 - ex: 176 + 1. first make a list of supported EISA IDS 177 + 178 + ex:: 179 + 180 + static const struct pnp_id pnp_dev_table[] = { 181 + /* Standard LPT Printer Port */ 182 + {.id = "PNP0400", .driver_data = 0}, 183 + /* ECP Printer Port */ 184 + {.id = "PNP0401", .driver_data = 0}, 185 + {.id = ""} 186 + }; 187 + 188 + Please note that the character 'X' can be used as a wild card in the function 189 + portion (last four characters). 190 + 191 + ex:: 192 + 216 193 /* Unknown PnP modems */ 217 194 { "PNPCXXX", UNKNOWN_DEV }, 218 195 219 - Supported PnP card IDs can optionally be defined. 220 - ex: 221 - static const struct pnp_id pnp_card_table[] = { 222 - { "ANYDEVS", 0 }, 223 - { "", 0 } 224 - }; 196 + Supported PnP card IDs can optionally be defined. 197 + ex:: 225 198 226 - 2.) Optionally define probe and remove functions. It may make sense not to 227 - define these functions if the driver already has a reliable method of detecting 228 - the resources, such as the parport_pc driver. 229 - ex: 230 - static int 231 - serial_pnp_probe(struct pnp_dev * dev, const struct pnp_id *card_id, const 232 - struct pnp_id *dev_id) 233 - { 234 - . . . 199 + static const struct pnp_id pnp_card_table[] = { 200 + { "ANYDEVS", 0 }, 201 + { "", 0 } 202 + }; 235 203 236 - ex: 237 - static void serial_pnp_remove(struct pnp_dev * dev) 238 - { 239 - . . . 204 + 2. Optionally define probe and remove functions. It may make sense not to 205 + define these functions if the driver already has a reliable method of detecting 206 + the resources, such as the parport_pc driver. 240 207 241 - consult /drivers/serial/8250_pnp.c for more information. 208 + ex:: 242 209 243 - 3.) create a driver structure 244 - ex: 210 + static int 211 + serial_pnp_probe(struct pnp_dev * dev, const struct pnp_id *card_id, const 212 + struct pnp_id *dev_id) 213 + { 214 + . . . 245 215 246 - static struct pnp_driver serial_pnp_driver = { 247 - .name = "serial", 248 - .card_id_table = pnp_card_table, 249 - .id_table = pnp_dev_table, 250 - .probe = serial_pnp_probe, 251 - .remove = serial_pnp_remove, 252 - }; 216 + ex:: 253 217 254 - * name and id_table cannot be NULL. 218 + static void serial_pnp_remove(struct pnp_dev * dev) 219 + { 220 + . . . 255 221 256 - 4.) register the driver 257 - ex: 222 + consult /drivers/serial/8250_pnp.c for more information. 258 223 259 - static int __init serial8250_pnp_init(void) 260 - { 261 - return pnp_register_driver(&serial_pnp_driver); 262 - } 224 + 3. create a driver structure 225 + 226 + ex:: 227 + 228 + static struct pnp_driver serial_pnp_driver = { 229 + .name = "serial", 230 + .card_id_table = pnp_card_table, 231 + .id_table = pnp_dev_table, 232 + .probe = serial_pnp_probe, 233 + .remove = serial_pnp_remove, 234 + }; 235 + 236 + * name and id_table cannot be NULL. 237 + 238 + 4. register the driver 239 + 240 + ex:: 241 + 242 + static int __init serial8250_pnp_init(void) 243 + { 244 + return pnp_register_driver(&serial_pnp_driver); 245 + } 263 246 264 247 The Old Way 265 - ........... 248 + ^^^^^^^^^^^ 266 249 267 250 A series of compatibility functions have been created to make it easy to convert 268 251 ISAPNP drivers. They should serve as a temporary solution only. 269 252 270 - They are as follows: 253 + They are as follows:: 271 254 272 - struct pnp_card *pnp_find_card(unsigned short vendor, 273 - unsigned short device, 274 - struct pnp_card *from) 255 + struct pnp_card *pnp_find_card(unsigned short vendor, 256 + unsigned short device, 257 + struct pnp_card *from) 275 258 276 - struct pnp_dev *pnp_find_dev(struct pnp_card *card, 277 - unsigned short vendor, 278 - unsigned short function, 279 - struct pnp_dev *from) 259 + struct pnp_dev *pnp_find_dev(struct pnp_card *card, 260 + unsigned short vendor, 261 + unsigned short function, 262 + struct pnp_dev *from) 280 263