diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-05-16 10:23:58 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2017-07-14 15:57:59 -0400 |
commit | 9a4aa7bfce3764b1795ce283b52808b72aad1a66 (patch) | |
tree | 40e169023a20b4fdd6a48ebd12073197c3bc7ba8 | |
parent | 5da98b8230fb998b0731b2ba3893461ff238a297 (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.txt | 343 |
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 | ================================= | ||
1 | Linux Plug and Play Documentation | 2 | Linux Plug and Play Documentation |
2 | by Adam Belay <ambx1@neo.rr.com> | 3 | ================================= |
3 | last 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 | ||
8 | Overview | 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 | otherwise unconfigurable devices. The Linux Plug and Play Layer provides these | 13 | otherwise unconfigurable devices. The Linux Plug and Play Layer provides these |
12 | services to compatible drivers. | 14 | services to compatible drivers. |
13 | 15 | ||
14 | 16 | ||
15 | |||
16 | The User Interface | 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 | for legacy and user level drivers that do not support Linux Plug and Play. The | 21 | for legacy and user level drivers that do not support Linux Plug and Play. The |
20 | user interface is integrated into sysfs. | 22 | user interface is integrated into sysfs. |
21 | 23 | ||
22 | In addition to the standard sysfs file the following are created in each | 24 | In addition to the standard sysfs file the following are created in each |
23 | device's directory: | 25 | device's directory: |
24 | id - displays a list of support EISA IDs | 26 | - id - displays a list of support EISA IDs |
25 | options - displays possible resource configurations | 27 | - options - displays possible resource configurations |
26 | resources - displays currently allocated resources and allows resource changes | 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 | this will invoke the automatic resource config system to activate the device | 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 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
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 | 51 | disabling a device |
52 | ^^^^^^^^^^^^^^^^^^ | ||
43 | 53 | ||
44 | #echo "disable" > resources | 54 | :: |
55 | |||
56 | # echo "disable" > resources | ||
45 | 57 | ||
46 | 58 | ||
47 | EXAMPLE: | 59 | EXAMPLE: |
48 | 60 | ||
49 | Suppose you need to activate the floppy disk controller. | 61 | Suppose you need to activate the floppy disk controller. |
50 | 1.) change to the proper directory, in my case it is | 62 | |
51 | /driver/bus/pnp/devices/00:0f | 63 | 1. 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 | |
54 | PC standard floppy disk controller | 66 | # cd /driver/bus/pnp/devices/00:0f |
55 | 67 | # cat name | |
56 | 2.) check if the device is already active | 68 | PC standard floppy disk controller |
57 | # cat resources | 69 | |
58 | DISABLED | 70 | 2. 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 | |
62 | 3.) check the device's possible configurations (optional) | 74 | |
63 | # cat options | 75 | - Notice the string "DISABLED". This means the device is not active. |
64 | Dependent: 01 - Priority acceptable | 76 | |
65 | port 0x3f0-0x3f0, align 0x7, size 0x6, 16-bit address decoding | 77 | 3. 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 |
69 | Dependent: 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 | |
75 | 4.) 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 | |
78 | 5.) finally check if the device is active | 90 | |
79 | # cat resources | 91 | 4. now activate the device:: |
80 | io 0x3f0-0x3f5 | 92 | |
81 | io 0x3f7-0x3f7 | 93 | # echo "auto" > resources |
82 | irq 6 | 94 | |
83 | dma 2 | 95 | 5. finally check if the device is active:: |
84 | 96 | ||
85 | also there are a series of kernel parameters: | 97 | # cat resources |
86 | pnp_reserve_irq=irq1[,irq2] .... | 98 | io 0x3f0-0x3f5 |
87 | pnp_reserve_dma=dma1[,dma2] .... | 99 | io 0x3f7-0x3f7 |
88 | pnp_reserve_io=io1,size1[,io2,size2] .... | 100 | irq 6 |
89 | pnp_reserve_mem=mem1,size1[,mem2,size2] .... | 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 | The Unified Plug and Play Layer | 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 | called the Plug and Play Layer. This layer is responsible for the exchange of | 116 | called the Plug and Play Layer. This layer is responsible for the exchange of |
97 | information between PnP drivers and PnP protocols. Thus it automatically | 117 | information between PnP drivers and PnP protocols. Thus it automatically |
98 | forwards commands to the proper protocol. This makes writing PnP drivers | 118 | forwards commands to the proper protocol. This makes writing PnP drivers |
@@ -101,64 +121,73 @@ significantly easier. | |||
101 | The following functions are available from the Plug and Play Layer: | 121 | The following functions are available from the Plug and Play Layer: |
102 | 122 | ||
103 | pnp_get_protocol | 123 | pnp_get_protocol |
104 | - increments the number of uses by one | 124 | increments the number of uses by one |
105 | 125 | ||
106 | pnp_put_protocol | 126 | pnp_put_protocol |
107 | - deincrements the number of uses by one | 127 | deincrements the number of uses by one |
108 | 128 | ||
109 | pnp_register_protocol | 129 | pnp_register_protocol |
110 | - use this to register a new PnP protocol | 130 | use this to register a new PnP protocol |
111 | 131 | ||
112 | pnp_unregister_protocol | 132 | pnp_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 | ||
115 | pnp_register_driver | 135 | pnp_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 | ||
122 | pnp_unregister_driver | 143 | pnp_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 | ||
127 | Plug and Play Protocols | 148 | Plug and Play Protocols |
128 | ----------------------- | 149 | ----------------------- |
129 | This section contains information for PnP protocol developers. | 150 | |
151 | This section contains information for PnP protocol developers. | ||
130 | 152 | ||
131 | The following Protocols are currently available in the computing world: | 153 | The 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. |
135 | devices. | 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 | |||
136 | It is meant to replace the PNPBIOS. It is not currently supported by Linux | 163 | It is meant to replace the PNPBIOS. It is not currently supported by Linux |
137 | Plug and Play but it is planned to be in the near future. | 164 | Plug and Play but it is planned to be in the near future. |
138 | 165 | ||
139 | 166 | ||
140 | Requirements for a Linux PnP protocol: | 167 | Requirements for a Linux PnP protocol: |
141 | 1.) the protocol must use EISA IDs | 168 | 1. the protocol must use EISA IDs |
142 | 2.) the protocol must inform the PnP Layer of a device's current configuration | 169 | 2. 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 | ||
145 | The following are PnP protocol related functions: | 173 | The following are PnP protocol related functions: |
146 | 174 | ||
147 | pnp_add_device | 175 | pnp_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 | |
150 | structure | 178 | only call this function when all wanted values are set in the pnp_dev |
179 | structure | ||
151 | 180 | ||
152 | pnp_init_device | 181 | pnp_init_device |
153 | - call this to initialize the PnP structure | 182 | call this to initialize the PnP structure |
154 | 183 | ||
155 | pnp_remove_device | 184 | pnp_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 | ||
160 | pnp_add_id | 189 | pnp_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 | ||
163 | For more information consult the source of a protocol such as | 192 | For 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 | ||
168 | Linux Plug and Play Drivers | 197 | Linux Plug and Play Drivers |
169 | --------------------------- | 198 | --------------------------- |
170 | This section contains information for Linux PnP driver developers. | 199 | |
200 | This section contains information for Linux PnP driver developers. | ||
171 | 201 | ||
172 | The New Way | 202 | The New Way |
173 | ........... | 203 | ^^^^^^^^^^^ |
174 | 1.) first make a list of supported EISA IDS | 204 | |
175 | ex: | 205 | 1. first make a list of supported EISA IDS |
176 | static 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}, | |
184 | Please note that the character 'X' can be used as a wild card in the function | 214 | {.id = ""} |
185 | portion (last four characters). | 215 | }; |
186 | ex: | 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 | ||
190 | Supported PnP card IDs can optionally be defined. | 225 | Supported PnP card IDs can optionally be defined. |
191 | ex: | 226 | ex:: |
192 | static 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 | }; | |
197 | 2.) Optionally define probe and remove functions. It may make sense not to | 232 | |
198 | define these functions if the driver already has a reliable method of detecting | 233 | 2. Optionally define probe and remove functions. It may make sense not to |
199 | the resources, such as the parport_pc driver. | 234 | define these functions if the driver already has a reliable method of detecting |
200 | ex: | 235 | the resources, such as the parport_pc driver. |
201 | static int | 236 | |
202 | serial_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) | |
207 | ex: | 242 | { |
208 | static void serial_pnp_remove(struct pnp_dev * dev) | 243 | . . . |
209 | { | 244 | |
210 | . . . | 245 | ex:: |
211 | 246 | ||
212 | consult /drivers/serial/8250_pnp.c for more information. | 247 | static void serial_pnp_remove(struct pnp_dev * dev) |
213 | 248 | { | |
214 | 3.) create a driver structure | 249 | . . . |
215 | ex: | 250 | |
216 | 251 | consult /drivers/serial/8250_pnp.c for more information. | |
217 | static struct pnp_driver serial_pnp_driver = { | 252 | |
218 | .name = "serial", | 253 | 3. 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, | |
227 | 4.) register the driver | 262 | .remove = serial_pnp_remove, |
228 | ex: | 263 | }; |
229 | 264 | ||
230 | static int __init serial8250_pnp_init(void) | 265 | * name and id_table cannot be NULL. |
231 | { | 266 | |
232 | return pnp_register_driver(&serial_pnp_driver); | 267 | 4. 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 | ||
235 | The Old Way | 276 | The Old Way |
236 | ........... | 277 | ^^^^^^^^^^^ |
237 | 278 | ||
238 | A series of compatibility functions have been created to make it easy to convert | 279 | A series of compatibility functions have been created to make it easy to convert |
239 | ISAPNP drivers. They should serve as a temporary solution only. | 280 | ISAPNP drivers. They should serve as a temporary solution only. |
240 | 281 | ||
241 | They are as follows: | 282 | They are as follows:: |
242 | 283 | ||
243 | struct 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 | ||
247 | struct 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 | ||