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