ISA Plug & Play support by Jaroslav Kysela ========================================================== Interface /proc/isapnp ====================== Read commands: -------------- No comment.. Write commands: --------------- With the write interface you can simply activate or modify the configuration for ISA Plug & Play devices. It is mainly useable for drivers which has not use the ISA Plug & Play kernel support yet. card - select PnP device by vendor identification csn - select PnP device by CSN dev - select logical device auto - run autoconfigure activate - activate logical device deactivate - deactivate logical device port - set port 0-7 to value irq - set IRQ 0-1 to value dma - set DMA 0-1 to value memory - set memory 0-3 to value poke - poke configuration byte to selected register pokew - poke configuration word to selected register poked - poke configuration dword to selected register Explanation: - variable begins with zero - variable begins with one - is in format 'PNP0000' - is in format 'PNP0000' Example: cat > /proc/isapnp <prepare() initializes the resource members in the device structure. This structure contains all resources set to auto configuration values after the initialization. The device driver may modify some resources to skip the auto configuration for a given resource. Once the device structure contains all requested resource values, the function dev->activate() must be called to assign free resources to resource members with the auto configuration value. Function dev->activate() does: - resources with the auto configuration value are configured - the auto configuration is created using ISA PnP resource map - the function writes configuration to ISA PnP configuration registers - the function returns to the caller actual used resources When the device driver is removing, function dev->deactivate() has to be called to free all assigned resources. Example (game port initialization) ================================== /*** initialization ***/ struct pci_dev *dev; /* find the first game port, use standard PnP IDs */ dev = isapnp_find_dev(NULL, ISAPNP_VENDOR('P','N','P'), ISAPNP_FUNCTION(0xb02f), NULL); if (!dev) return -ENODEV; if (dev->active) return -EBUSY; if (dev->prepare(dev)<0) return -EAGAIN; if (!(dev->resource[0].flags & IORESOURCE_IO)) return -ENODEV; if (!dev->ro) { /* override resource */ if (user_port != USER_PORT_AUTO_VALUE) isapnp_resource_change(&dev->resource[0], user_port, 1); } if (dev->activate(dev)<0) { printk("isapnp configure failed (out of resources?)\n"); return -ENOMEM; } user_port = dev->resource[0].start; /* get real port */ /*** deactivation ***/ /* to deactivate use: */ if (dev) dev->deactivate(dev);