1 ISA Plug & Play support by Jaroslav Kysela <perex@suse.cz>
2 ==========================================================
15 With the write interface you can simply activate or modify the configuration
16 for ISA Plug & Play devices. It is mainly useable for drivers which has not
17 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
34 - variable <idx> begins with zero
35 - variable <CSN> begins with one
36 - <vendor> is in format 'PNP0000'
37 - <logdev> is in format 'PNP0000'
41 cat > /proc/isapnp <<EOF
58 Information for developers
59 ==========================
61 Finding appropriate device
62 --------------------------
64 extern struct pci_bus *isapnp_find_card(unsigned short vendor,
65 unsigned short device,
66 struct pci_bus *from);
68 This function finds a ISA PnP card. For the vendor device should
69 be used ISAPNP_VENDOR(a,b,c) where a,b,c are characters or integers.
70 For the device number should be used ISAPNP_DEVICE(x) macro where x is
71 integer value. Both vendor and device numbers can be taken from contents
72 of the /proc/isapnp file.
74 extern struct pci_dev *isapnp_find_dev(struct pci_bus *card,
75 unsigned short vendor,
76 unsigned short function,
77 struct pci_dev *from);
79 This function finds the ISA PnP device. If card is NULL, then
80 the global search mode is used (all devices are used for the searching).
81 Otherwise only devices which belongs to the specified card are verified.
82 For the function number can be used ISAPNP_FUNCTION(x) macro which works
83 similarly as the ISAPNP_DEVICE(x) macro.
85 extern int isapnp_probe_cards(const struct isapnp_card_id *ids,
86 int (*probe)(struct pci_bus *card,
87 const struct isapnp_card_id *id));
90 This function is a helper for drivers which requires to use more than
91 one device from an ISA PnP card. For each cards is called the probe
92 callback with appropriate information.
94 Example for ids parameter initialization:
96 static struct isapnp_card_id card_ids[] __devinitdata = {
98 ISAPNP_CARD_ID('A','D','V', 0x550a),
100 ISAPNP_DEVICE_ID('A', 'D', 'V', 0x0010),
101 ISAPNP_DEVICE_ID('A', 'D', 'V', 0x0011)
109 ISAPNP_CARD_TABLE(card_ids);
111 extern int isapnp_probe_devs(const struct isapnp_device_id *ids,
112 int (*probe)(struct pci_bus *card,
113 const struct isapnp_device_id *id));
116 This function is a helper for drivers which requires to use one
117 device from an ISA PnP card. For each matched devices is called the probe
118 callback with appropriate information.
120 Example for ids parameter initialization:
122 static struct isapnp_device_id device_ids[] __devinitdata = {
123 { ISAPNP_DEVICE_SINGLE('E','S','S', 0x0968, 'E','S','S', 0x0968), },
124 { ISAPNP_DEVICE_SINGLE_END, }
126 MODULE_DEVICE_TABLE(isapnp, device_ids);
129 ISA PnP configuration
130 =====================
132 There are two ways how can be ISA PnP interface used.
134 First way is lowlevel
135 ---------------------
137 All ISA PNP configuration registers are accessible via lowlevel
138 isapnp_(read|write)_(byte|word|dword) functions.
140 The function isapnp_cfg_begin() must be called before any lowlevel function.
141 The function isapnp_cfg_end() must be always called after configuration
142 otherwise the access to the ISA PnP configuration functions will be blocked.
144 Second way is auto-configuration
145 --------------------------------
147 This feature gives to the driver the real power of the ISA PnP code.
148 Function dev->prepare() initializes the resource members in the device
149 structure. This structure contains all resources set to auto configuration
150 values after the initialization. The device driver may modify some resources
151 to skip the auto configuration for a given resource.
153 Once the device structure contains all requested resource values, the function
154 dev->activate() must be called to assign free resources to resource members
155 with the auto configuration value.
157 Function dev->activate() does:
158 - resources with the auto configuration value are configured
159 - the auto configuration is created using ISA PnP resource map
160 - the function writes configuration to ISA PnP configuration registers
161 - the function returns to the caller actual used resources
163 When the device driver is removing, function dev->deactivate() has to be
164 called to free all assigned resources.
166 Example (game port initialization)
167 ==================================
169 /*** initialization ***/
173 /* find the first game port, use standard PnP IDs */
174 dev = isapnp_find_dev(NULL,
175 ISAPNP_VENDOR('P','N','P'),
176 ISAPNP_FUNCTION(0xb02f),
182 if (dev->prepare(dev)<0)
184 if (!(dev->resource[0].flags & IORESOURCE_IO))
187 /* override resource */
188 if (user_port != USER_PORT_AUTO_VALUE)
189 isapnp_resource_change(&dev->resource[0], user_port, 1);
191 if (dev->activate(dev)<0) {
192 printk("isapnp configure failed (out of resources?)\n");
195 user_port = dev->resource[0].start; /* get real port */
197 /*** deactivation ***/
199 /* to deactivate use: */
201 dev->deactivate(dev);