Next Previous Contents

5. How to Deal with PnP Cards

5.1 Introduction to Dealing with PnP Cards

Today most all new internal boards (cards) are Plug-and-Play (PnP). Although some software exists in Linux to handle PnP, it is not always easy to use. There are 6 different methods listed below to cope with PnP (but some may not be feasible in your situation). Which one(s) you should use depends on your goals. What may be most expedient to do now may not be the easiest and best in the long run. A seemingly simple way is to do nothing and just let a PnP-BIOS configure it but then you may need to do some exploring to to find out what the BIOS has done. A comparison of these methods needs to be written by someone who has tried them all. You may need to use more than one method to do the job.

Any of the above will set the bus-resources in the hardware. But only the last two should tell device driver what it's done. Only the last one definitely tells the driver (since it is the driver). How the driver gets informed depends on the driver and you may need to do something to inform it. See Tell the Driver the Configuration

5.2 Disable PnP ?

Many devices are PnP only with no option for disabling PnP. But for some, you may be able to disable PnP by jumpers or by running a Windows program that comes with the device (jumperless configuration). This will avoid the often complicated task of configuring PnP. Don't forget to tell the BIOS that these bus-resources are reserved. There are also some reasons why you might not want to disable PnP:

  1. If you have MS Windows on the same machine, then you may want to allow PnP to configure devices differently under Windows from what it does under Linux.
  2. The range of selection for IRQ numbers (or port addresses) etc. may be quite limited unless you use PnP.
  3. You might have a Linux device driver that uses PnP methods to search for the device it controls.
  4. If you need to change the configuration in the future, it may be easier to do this if it's PnP (no setting of jumpers or running a Dos/Windows program).
  5. You may have (or will have) other PnP devices that need configuring so that you'll need to provide for (or learn about) PnP anyway.
Once configured as non-PnP devices, they can't be configured by PnP software or the BIOS (until you move jumpers and/or use the Dos/Windows configuration software again).

5.3 BIOS Configures PnP

Intro to Using the BIOS to Configure PnP

If you have a PnP BIOS, it can configure the hardware. This means that your BIOS reads the resource requirements of all devices and configures them (allocates bus-resources to them). It is a substitute for a PnP OS except that the BIOS doesn't match up the with their devices nor tell the drivers how it has done the configuring. It should normally use the configuration it has stored in its non-volatile memory (ESCD). If it finds a new device or if there's a conflict, the BIOS should make the necessary changes to the configuration and will not use exactly what was in the ESCD.

Your BIOS must support such configuring but there have been cases where it doesn't do it correctly or completely. An advantage of using the BIOS is that it's simple since in most cases there is nothing to set up (except to tell the BIOS's CMOS menu it's not a PnP OS). While some device drivers may be able to automatically detect what the BIOS has done, in some cases you'll need to determine it (not always easy). See What Is My Current Configuration? Another possible advantage is that the BIOS does its work before Linux starts so that all the bus-resources are ready to be used (and found) by the device drivers that start up later.

According to MS it's only optional (not required) that a PnP BIOS be able to PnP-configure the devices (without help from MS Windows). But it seems that most of the ones made after 1996 ?? or so can do it. We should send them thank-you notes if they do it right. They configure both the PCI and ISA buses, but it has been claimed that some older BIOSs can only do the PCI. To try to find out more about your BIOS, look on the Web. Please don't ask me as I don't have data on this. The details of the BIOS that you would like to know about may be hard to find (or not available). Some BIOSs may have minimal PnP capabilities and try to turn over the difficult parts of the configuration task to Window utilities. If this happens you'll either have to find another method (such as isapnptools) or try to set up the ESCD database if the BIOS has one. See the next section.

The BIOS's ESCD Database

The BIOS's maintains a non-volatile database containing a PnP-configuration that it will try to use. It's called the ESCD (Extended System Configuration Data). Again, the provision of ESCD is optional but most PnP-BIOSs have it. The ESCD not only stores the resource-configuration of PnP devices but also stores configuration information of non-PnP devices (and marks them as such) so as to avoid conflicts. The ESCD data is usually saved on a chip and remains intact when the power is off, but sometimes it's kept on a hard-drive??

The ESCD is intended to hold the last used configuration, but if you use a program such as Linux's isapnp or pci utilities (which doesn't update the ESCD) then the ESCD will not know about this and will not save this configuration in the ESCD. A good PnP OS might update the ESCD so you can use it later on for a non-PnP OS (like standard Linux). MS Windows does this only in special cases. See Using Windows to set ESCD.

To use what's set in ESCD be sure you've set "Not a PnP OS" or the like in the BIOS's CMOS. Then each time the BIOS starts up (before the Linux OS is loaded) it should configure things this way. If the BIOS detects a new PnP card which is not in the ESCD, then it must then allocate bus-resources to the card and update the ESCD. It may even have to change the bus-resources assigned to existing PnP cards and modify ESCD accordingly.

If each device saved its last configuration in its hardware, hardware configuring wouldn't be needed each time you start your PC. But it doesn't work this way. So all the ESCD data needs to be kept correct if you use the BIOS for PnP. There are some BIOSs that don't have an ESCD but do have some non-volatile memory to store info on which bus-resources have been reserved for use by non-PnP cards. Many BIOSs have both.

Using Windows to set the ESCD

If the BIOS doesn't set up the ESCD the way you want it (or the way it should be) then it would be nice to have a Linux utility to set the ESCD. As of early 1999 there isn't any. Thus one may resort to attempting to use Windows (if you have it on the same PC) to do this.

There are three ways to use Windows to try to set/modify the ESCD. One way is to use the ICU utility designed for DOS or Windows 3.x. It should also work OK for Windows 9x/2k ?? Another way is to set up devices manually ("forced") under Windows 9x/2k so that Windows will put this info into the ESCD when Windows is shut down normally. The third way is only for legacy devices that are not plug-and-play. If Windows knows about them and what bus-resources they use, then Windows should put this info into the ESCD.

If PnP devices are configured automatically by Windows without the user "forcing" it to change settings, then such setting will probably not make it into the ESCD. Of course Windows may well decide on its own to configure the same as what is set in the ESCD so they could wind up being the same by coincidence.

Windows 9x are PnP operating systems and automatically PnP-configure devices. They maintain their own PnP-database deep down in the Registry (stored in binary Windows files). There is also a lot of other configuration stuff in the Registry besides PnP-bus-resources. There is both a current PnP resource configuration in memory and another (perhaps about the same) stored on the hard disk. To look at (the one in memory?) this indirectly in Windows98 or to force changes you use the Device Manager.

In Windows98 There are 2 ways to get to the Device Manager: 1. My Computer --> Control Panel --> System Properties --> Device Manager. 2. (right-click) My Computer --> Properties --> Device Manager. Then in Device Manager you select a device (sometimes a multi-step process if there are a few devices of the same class). Then click on Properties and then on Resources. To attempt to change the resource configuration manually, uncheck "Use automatic settings" and then click on "Change Settings". Now try to change the setting, but it may not let you change it. If it does let you, you have "forced" a change. A message should inform you that it's being forced. If you want to keep the existing setting shown by Windows but make it "forced" then you will have to force a change to something else and then force it back to its original setting.

To see what has been "forced" under Windows98 look at the "forced hardware" list: Start --> Programs --> Accessories --> System Tools --> System Information --> Hardware Resources --> Forced Hardware. When you "force" a change of bus-resources in Windows, it should put your change into the ESCD (provided you exit Windows normally). >From the "System Information" window you may also inspect how IRQs and IO ports have been allocated under Windows.

Even if Windows shows no conflict of bus-resources, there may be a conflict under Linux. That's because Windows may assign bus-resources differently than the ESCD does. In the the rare case where all devices under Windows are either legacy devices or have been "forced", then Windows and the ESCD configurations should be identical.

Adding a New Device (under Linux or Windows)

If you add a new PnP device and have the BIOS set to "not a PnP OS", then the BIOS should automatically configure it and store the configuration in ESCD. If it's a non-PnP legacy device (or one made that way by jumpers, etc.) then there are a few options to handle it.

You may be able to tell the BIOS directly (via the CMOS setup menus) that certain bus-resources it uses (such as IRQs) are reserved and are not to be allocated by PnP. This does not put this info into the ESCD. But there may be a BIOS menu selection as to whether or not to have these CMOS choices override what may be in the ESCD in case of conflict. Another method is to run ICU under DOS/Windows. Still another is to install it manually under Windows 9x/2k and then make sure its configuration is "forced" (see the previous section). If it's "forced" Windows should update the ESCD when you shut down the PC.

5.4 Isapnp (part of isapnptools)

Unfortunately, much of the documentation for isapnp is still difficult to understand unless you know the basics of PnP. This HOWTO should help you understand it as well the FAQ that comes with it. isapnp is only for PnP devices on the ISA bus (non-PCI). Running the Linux program "isapnp" at boot-time will configure such devices to the resource values specified in /etc/isapnp.conf. Its possible to create this configuration file automatically but you then must edit it manually to chose between various options. With isapnp, a device driver which is part of the kernel may run too early before isapnp has set the address, etc. in the hardware. This results in the device driver not being able to find the device. The driver trys the right address but the address hasn't been set yet in the hardware.

If your Linux distribution automatically installed isapnptools, isapnp may already be running at startup. In this case, all you need to do is to edit /etc/isapnp.conf per "man isapnp.conf". Note that this is like manually configuring PnP since you make the decisions as to how to configure as you edit the configuration file. You can use the program "pnpdump" to help create the configuration file. It almost creates a configuration file for you but you must skillfully edit it a little before using it. It contains some comments to help you edit it. If you use "isapnp" for configuring and have a PnP BIOS, you should probably tell the BIOS (when you set it up) that you don't have a PnP OS since you may want the BIOS to configure the PCI devices. While the BIOS may also configure the ISA devices, isapnp will redo it.

The terminology used in the /etc/isapnp.conf file may seem odd at first. For example for an I0 address of 0x3e8 you might see "(IO 0 (BASE 0x3e8))" instead. The "IO 0" means this is the first (0th) IO address-range that this device uses. Another way to express all this would be: IO[0] = 0x3e8" but isapnp doesn't do it this way. IO 1" would mean that this is the second IO address range used by this device, etc. "INT 0" has a similar meaning but for IRQs (interrupts). A single card may contain several physical devices and the above explanation was for just one of these devices.

5.5 PCI Utilities

The new package PCI Utilities (= pciutils, incorrectly called "pcitools"), should let you manually PnP-configure the PCI bus. "lspci" lists bus-resources while "setpci" sets resource allocations in the hardware devices.

5.6 Patch the Kernel to Make Linux PnP

David Howells has created a patch to do this called "Linux Kernel Configuration/Resource Manager" (sometimes called Hardware Configuration Manager). In late 1999 the patch was not available at his website. This may mean there is no patch available for recent versions of the kernel.

For previous patches the resulting kernel was claimed to be stable but bugs have been reported. The patch included documentation such as serial.txt to show how to deal with the serial port. It provided "files" in the /proc tree so that you can see what is going on and can echo commands into one of these files for custom configuration. One problem is that most device drivers don't know about it so that you still had to use the traditional configuration files, etc. for configuration. The webpage for it is http://www.astarte.free-online.co.uk

5.7 Windows Configures

If you have Windows9x (or 2k) on the same PC, then just start Windows and let it configure PnP. Then start Linux from Windows (or DOS). It been reported that Windows erased the IRQs from PCI devices registers. Then Linux complained that it found a zero IRQ. Thus you may not be able to use this method.

5.8 Device Driver Configures

A few device drivers will use PnP methods to set the bus-resources in the hardware but only for the device that they control. Since the driver has done the configuring, it obviously knows the configuration and there is no need for you to tell it this info.

The problem with this is twofold. It's difficult to incorporate all of this into the driver, and the driver may grab bus-resources that are needed by other devices. It does make it easy for the user but a PnP Linux kernel might be better. See Linux Needs to Cope Better with PnP

5.9 PnP Software/Documents


Next Previous Contents