aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/pnp.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/pnp.txt')
-rw-r--r--Documentation/pnp.txt249
1 files changed, 249 insertions, 0 deletions
diff --git a/Documentation/pnp.txt b/Documentation/pnp.txt
new file mode 100644
index 000000000000..af0f6eabfa1c
--- /dev/null
+++ b/Documentation/pnp.txt
@@ -0,0 +1,249 @@
1Linux Plug and Play Documentation
2by Adam Belay <ambx1@neo.rr.com>
3last updated: Oct. 16, 2002
4---------------------------------------------------------------------------------------
5
6
7
8Overview
9--------
10 Plug and Play provides a means of detecting and setting resources for legacy or
11otherwise unconfigurable devices. The Linux Plug and Play Layer provides these
12services to compatible drivers.
13
14
15
16The User Interface
17------------------
18 The 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
20user interface is integrated into driverfs.
21
22In addition to the standard driverfs file the following are created in each
23device's directory:
24id - displays a list of support EISA IDs
25options - displays possible resource configurations
26resources - displays currently allocated resources and allows resource changes
27
28-activating a device
29
30#echo "auto" > resources
31
32this will invoke the automatic resource config system to activate the device
33
34-manually activating a device
35
36#echo "manual <depnum> <mode>" > resources
37<depnum> - the configuration number
38<mode> - static or dynamic
39 static = for next boot
40 dynamic = now
41
42-disabling a device
43
44#echo "disable" > resources
45
46
47EXAMPLE:
48
49Suppose you need to activate the floppy disk controller.
501.) 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
54PC standard floppy disk controller
55
562.) check if the device is already active
57# cat resources
58DISABLED
59
60- Notice the string "DISABLED". THis means the device is not active.
61
623.) check the device's possible configurations (optional)
63# cat options
64Dependent: 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
69Dependent: 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
74
754.) now activate the device
76# echo "auto" > resources
77
785.) finally check if the device is active
79# cat resources
80io 0x3f0-0x3f5
81io 0x3f7-0x3f7
82irq 6
83dma 2
84
85also there are a series of kernel parameters:
86pnp_reserve_irq=irq1[,irq2] ....
87pnp_reserve_dma=dma1[,dma2] ....
88pnp_reserve_io=io1,size1[,io2,size2] ....
89pnp_reserve_mem=mem1,size1[,mem2,size2] ....
90
91
92
93The Unified Plug and Play Layer
94-------------------------------
95 All 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
97information between PnP drivers and PnP protocols. Thus it automatically
98forwards commands to the proper protocol. This makes writing PnP drivers
99significantly easier.
100
101The following functions are available from the Plug and Play Layer:
102
103pnp_get_protocol
104- increments the number of uses by one
105
106pnp_put_protocol
107- deincrements the number of uses by one
108
109pnp_register_protocol
110- use this to register a new PnP protocol
111
112pnp_unregister_protocol
113- use this function to remove a PnP protocol from the Plug and Play Layer
114
115pnp_register_driver
116- adds a PnP driver to the Plug and Play Layer
117- this includes driver model integration
118
119pnp_unregister_driver
120- removes a PnP driver from the Plug and Play Layer
121
122
123
124Plug and Play Protocols
125-----------------------
126 This section contains information for PnP protocol developers.
127
128The following Protocols are currently available in the computing world:
129- PNPBIOS: used for system devices such as serial and parallel ports.
130- ISAPNP: provides PnP support for the ISA bus
131- ACPI: among its many uses, ACPI provides information about system level
132devices.
133It is meant to replace the PNPBIOS. It is not currently supported by Linux
134Plug and Play but it is planned to be in the near future.
135
136
137Requirements for a Linux PnP protocol:
1381.) the protocol must use EISA IDs
1392.) the protocol must inform the PnP Layer of a devices current configuration
140- the ability to set resources is optional but prefered.
141
142The following are PnP protocol related functions:
143
144pnp_add_device
145- use this function to add a PnP device to the PnP layer
146- only call this function when all wanted values are set in the pnp_dev
147structure
148
149pnp_init_device
150- call this to initialize the PnP structure
151
152pnp_remove_device
153- call this to remove a device from the Plug and Play Layer.
154- it will fail if the device is still in use.
155- automatically will free mem used by the device and related structures
156
157pnp_add_id
158- adds a EISA ID to the list of supported IDs for the specified device
159
160For more information consult the source of a protocol such as
161/drivers/pnp/pnpbios/core.c.
162
163
164
165Linux Plug and Play Drivers
166---------------------------
167 This section contains information for linux PnP driver developers.
168
169The New Way
170...........
1711.) first make a list of supported EISA IDS
172ex:
173static const struct pnp_id pnp_dev_table[] = {
174 /* Standard LPT Printer Port */
175 {.id = "PNP0400", .driver_data = 0},
176 /* ECP Printer Port */
177 {.id = "PNP0401", .driver_data = 0},
178 {.id = ""}
179};
180
181Please note that the character 'X' can be used as a wild card in the function
182portion (last four characters).
183ex:
184 /* Unkown PnP modems */
185 { "PNPCXXX", UNKNOWN_DEV },
186
187Supported PnP card IDs can optionally be defined.
188ex:
189static const struct pnp_id pnp_card_table[] = {
190 { "ANYDEVS", 0 },
191 { "", 0 }
192};
193
1942.) Optionally define probe and remove functions. It may make sense not to
195define these functions if the driver already has a reliable method of detecting
196the resources, such as the parport_pc driver.
197ex:
198static int
199serial_pnp_probe(struct pnp_dev * dev, const struct pnp_id *card_id, const
200 struct pnp_id *dev_id)
201{
202. . .
203
204ex:
205static void serial_pnp_remove(struct pnp_dev * dev)
206{
207. . .
208
209consult /drivers/serial/8250_pnp.c for more information.
210
2113.) create a driver structure
212ex:
213
214static struct pnp_driver serial_pnp_driver = {
215 .name = "serial",
216 .card_id_table = pnp_card_table,
217 .id_table = pnp_dev_table,
218 .probe = serial_pnp_probe,
219 .remove = serial_pnp_remove,
220};
221
222* name and id_table can not be NULL.
223
2244.) register the driver
225ex:
226
227static int __init serial8250_pnp_init(void)
228{
229 return pnp_register_driver(&serial_pnp_driver);
230}
231
232The Old Way
233...........
234
235a series of compatibility functions have been created to make it easy to convert
236
237ISAPNP drivers. They should serve as a temporary solution only.
238
239they are as follows:
240
241struct pnp_card *pnp_find_card(unsigned short vendor,
242 unsigned short device,
243 struct pnp_card *from)
244
245struct pnp_dev *pnp_find_dev(struct pnp_card *card,
246 unsigned short vendor,
247 unsigned short function,
248 struct pnp_dev *from)
249