1 ISA Plug & Play support by Jaroslav Kysela <perex@suse.cz>
2 ==========================================================
15 With the write interface you can activate or modify the configuration of
16 ISA Plug & Play devices. It is mainly useful for drivers which have not
17 been rewritten to use the ISA Plug & Play kernel support yet.
19 card <idx> <vendor> - select PnP device by vendor identification
20 csn <CSN> - select PnP device by CSN
21 dev <idx> <logdev> - select logical device
22 auto - run autoconfigure
23 activate - activate logical device
24 deactivate - deactivate logical device
25 port <idx> <value> - set port 0-7 to value
26 irq <idx> <value> - set IRQ 0-1 to value
27 dma <idx> <value> - set DMA 0-1 to value
28 memory <idx> <value> - set memory 0-3 to value
29 poke <reg> <value> - poke configuration byte to selected register
30 pokew <reg> <value> - poke configuration word to selected register
31 poked <reg> <value> - poke configuration dword to selected register
32 allow_dma0 <value> - allow dma channel 0 during auto activation: 0=off, 1=on
35 - variable <idx> begins with zero
36 - variable <CSN> begins with one
37 - <vendor> is in the standard format 'ABC1234'
38 - <logdev> is in the standard format 'ABC1234'
42 cat > /proc/isapnp <<EOF
59 Information for developers
60 ==========================
65 extern struct pci_bus *isapnp_find_card(unsigned short vendor,
66 unsigned short device,
67 struct pci_bus *from);
69 This function finds an ISA PnP card. For the vendor argument, the
70 ISAPNP_VENDOR(a,b,c) macro should be used, where a,b,c are characters or
71 integers. For the device argument the ISAPNP_DEVICE(x) macro should be
72 used, where x is an integer value. Both vendor and device arguments
73 can be taken from contents of the /proc/isapnp file.
75 extern struct pci_dev *isapnp_find_dev(struct pci_bus *card,
76 unsigned short vendor,
77 unsigned short function,
78 struct pci_dev *from);
80 This function finds an ISA PnP device. If card is NULL, then the global
81 search mode is used (all devices are used for the searching). Otherwise
82 only devices which belong to the specified card are checked. For the
83 function number the ISAPNP_FUNCTION(x) macro can be used; it works
84 similarly to the ISAPNP_DEVICE(x) macro.
86 extern int isapnp_probe_cards(const struct isapnp_card_id *ids,
87 int (*probe)(struct pci_bus *card,
88 const struct isapnp_card_id *id));
91 This function is a helper for drivers which need to use more than
92 one device from an ISA PnP card. The probe callback is called with
93 appropriate arguments for each card.
95 Example for ids parameter initialization:
97 static struct isapnp_card_id card_ids[] __devinitdata = {
99 ISAPNP_CARD_ID('A','D','V', 0x550a),
101 ISAPNP_DEVICE_ID('A', 'D', 'V', 0x0010),
102 ISAPNP_DEVICE_ID('A', 'D', 'V', 0x0011)
110 ISAPNP_CARD_TABLE(card_ids);
112 extern int isapnp_probe_devs(const struct isapnp_device_id *ids,
113 int (*probe)(struct pci_bus *card,
114 const struct isapnp_device_id *id));
117 This function is a helper for drivers which need to use one
118 device from an ISA PnP card. The probe callback is called with
119 appropriate arguments for each matched device.
121 Example for ids parameter initialization:
123 static struct isapnp_device_id device_ids[] __devinitdata = {
124 { ISAPNP_DEVICE_SINGLE('E','S','S', 0x0968, 'E','S','S', 0x0968), },
125 { ISAPNP_DEVICE_SINGLE_END, }
127 MODULE_DEVICE_TABLE(isapnp, device_ids);
130 ISA PnP configuration
131 =====================
133 There are two ways in which the ISA PnP interface can be used.
138 All ISA PNP configuration registers are accessible via the low-level
139 isapnp_(read|write)_(byte|word|dword) functions.
141 The function isapnp_cfg_begin() must be called before any lowlevel function.
142 The function isapnp_cfg_end() must be always called after configuration
143 otherwise the access to the ISA PnP configuration functions will be blocked.
145 Second way: auto-configuration
146 ------------------------------
148 This feature gives to the driver the real power of the ISA PnP driver.
149 The function dev->prepare() initializes the resource members in the device
150 structure. This structure contains all resources set to auto configuration
151 values after the initialization. The device driver may modify some resources
152 to skip the auto configuration for a given resource.
154 Once the device structure contains all requested resource values, the function
155 dev->activate() must be called to assign free resources to resource members
156 with the auto configuration value.
158 Function dev->activate() does:
159 - resources with the auto configuration value are configured
160 - the auto configuration is created using ISA PnP resource map
161 - the function writes configuration to ISA PnP configuration registers
162 - the function returns to the caller actual used resources
164 When the device driver is removed, function dev->deactivate() has to be
165 called to free all assigned resources.
167 Example (game port initialization)
168 ==================================
170 /*** initialization ***/
174 /* find the first game port, use standard PnP IDs */
175 dev = isapnp_find_dev(NULL,
176 ISAPNP_VENDOR('P','N','P'),
177 ISAPNP_FUNCTION(0xb02f),
183 if (dev->prepare(dev)<0)
185 if (!(dev->resource[0].flags & IORESOURCE_IO))
188 /* override resource */
189 if (user_port != USER_PORT_AUTO_VALUE)
190 isapnp_resource_change(&dev->resource[0], user_port, 1);
192 if (dev->activate(dev)<0) {
193 printk("isapnp configure failed (out of resources?)\n");
196 user_port = dev->resource[0].start; /* get real port */
198 /*** deactivation ***/
200 /* to deactivate use: */
202 dev->deactivate(dev);