WDM drivers for non-PaP devices

You've come to this page because you've asked a question similar to the following:

I have an ISA device that needs to have its base memory address software configured. However, I need to ensure that the address I configure isn't used by another device. This device is not plug-and-play and can't be hardware configured for its base memory address.

This is the Frequently Given Answer to that question.

If you are targetting Windows NT version 4, then IoReportResourceUsage() is the correct mechanism to use.

If, however, you are targetting Windows NT version 5.0 or later, then the correct mechanism is, surprisingly, to write a Plug and Play device driver. It doesn't matter that your ISA device isn't an ISA P&P device. You still write a P&P device driver to drive it.

The key lies in your INF file. The list of resource requirements that, in the case of a device on a "software enumerable" bus such as a PCI or ISA P&P device, would be obtained from the device's configuration space can, for a non-P&P ISA device, be specified in the INF file.

What you do is specify in the DDInstall section for your ISA device a LogConfig directive pointing to a section that defines the resource requirements for the device with a group of IOConfig, IRQConfig, MemConfig and suchlike directives. (For convenience you would also add a FactDef section, which will help the Add Hardware Wizard to skip one of the more tedious parts of the installation procedure.) The IOConfig and IRQConfig directives specify ranges containing a single value, which are whatever IRQ/Ports your device is hardwired to. The MemConfig specifies the allowable ranges of memory that your device can be programmed to occupy.

The Add Hardware Wizard will take this information from the INF file and insert it into the Registry. The P&P Manager will then use this information as the device's resource requirements, just as if it had read them from a configuration space. It will arbitrate the resources amongst the devices on the system using the requested ranges, and eventually end up passing your P&P driver a "start device" IORP. Attached to this IORP will be the memory range that the P&P Manager has arbitrated for your device. All that your driver needs to do is at that point to program the allocated memory range into your device.

Apart from that, your driver should treat your device exactly as if it were a P&P device. In particular, unlike in Windows NT 4 model, there is no need to go probing for the existence of your ISA device in various "known" places and manually requesting the resources that you need. The user, the Device Manager, the Add Hardware Wizard, and the P&P Manager in concert will handle all of that for you. As far as your driver is concerned, your device is a P&P device. Your driver will be told when and if the device exists, and where (in terms of resource allocations) it can physically find it.

In fact, as far as most of the system is concerned, your device is a P&P device. It is just a P&P device that is very fussy about its resource requirements, that has a rather odd configuration space access mechanism, and that cannot be enabled or disabled without rebooting.

© Copyright 2000–2001 Jonathan de Boyne Pollard. "Moral" rights asserted.
Permission is hereby granted to copy and to distribute this web page in its original, unmodified form as long as its last modification datestamp is preserved.