Saturday, November 9, 2013

Plug and Play devices

Plug and Play (PnP) is a system for configuring devices, usually in the form of add-in cards, that enables them to work together without conflicting with each other. PnP consists of:
* PnP and non PnP cards (devices)
* PnP initialisation and run-time routines within the Operating System (OS) and utility software
* PnP BIOS routines
There are three types of PnP cards that can be auto-configured:
* PCI
* PnP ISA
* PC Cards (PCMCIA).
All other devices are non PnP, have a static configuration and classified as ISA Legacy Devices. PnP devices are configured around Legacy devices. Windows95 configures Legacy devices with the 'Add New Hardware' wizard. Resource Usage (IRQs, I/O ports, DMA channels and memory windows): PnP can use one of two methods of determining resource usage.
1. Determine the resources that are not generically detectable and establish the areas unavailable for configurable devices.
2. Extended System Configuration Data (ESCD) method. ESCD stores Legacy information and the Last Working Configuration (LWC) of configurable devices. This allows the system to ensure that resource assignment and device placements are the same each time the computer is powered on. This is important when using device drivers that get their resource allocation information from a static source, such as the command line parameters in config.sys file.
A fully PnP compliant system requires a PnP BIOS. ESCD configures PnP boot devices as part of the Power On Self Test (POST) before booting the operating system. ESCD also allows run-time software (Windows95 Device Manager) to request specific resource assignments for PnP devices. This allows difficult to place configurations to be manually setup or disabled.
PnP elements: There are four elements to a PnP system.
1. The PnP BIOS starts the auto-configuration of the PnP cards during the POST. This in turn isolates any Legacy devices and ascertains the resource needs of PnP devices.
2. The ESCD functions are used to determine resources already in use by Legacy devices, and which are available for PnP devices. A PnP BIOS must be able to configure the card or cards that are required to boot the operating system (video and disk controllers), and may also configure all the cards in the computer, which is necessary for operating systems that don't feature native support for PnP cards. After identifying the PnP cards, the PnP BIOS compares these cards with those in the ESCD. If found, they are configured as stored in the corresponding ESCD entry. This ensures that when no new hardware has been installed, the PnP devices are configured identically for each session. If the PnP BIOS cannot find an entry in the ESCD, it consults the ESCD to determine what resources are free and assigns these to the new card. In addition, the ESCD allows system software and utilities to communicate with the BIOS, by placing their desired resource allocations in the ESCD.
3. The Configuration Manager (CM), configures the PnP cards not configured by the PnP BIOS, by using the ESCD in a similar manner as the BIOS does.
4. The ISA Configuration Utility (ICU) is designed to assist in determining a conflict-free configuration for standard (Legacy) ISA cards, as well as providing advanced configuration support for PnP cards. The ICU will allow certain functions in multi-function cards to be disabled and the configuration of particular cards to be locked: primarily for use with non PnP supporting operating systems.
The PnP BIOS:
The PnP BIOS performs the following steps to configure the PnP devices before starting the machine:
* Builds a structure called the Resource Map, to determine the available system resources - IRQ, I/O ports, DMA channels and memory windows.
* The Resource Map is then initialised to indicate the resources available.
* The BIOS determines the resources used by the system board devices, either by looking up the information in the ESCD, or by enquiring from the BIOS the resources used by system board devices.
* The PnP BIOS then interrogates the ESCD in order to determine resources that are allocated to Legacy cards, and updates the Resource Map. At this stage, the Resource Map contains all the necessary information on all Legacy devices.
* PnP ISA cards are examined to establishes its resource needs.
* After identification, the boards are configured, starting with the last known working configuration for each card in the ESCD. For new cards, the system will use the first alternative configuration that matches the card's resource requirements. However, if none are found, then the next set of available resources is tried. If the system runs out of resources, it will go back to the previously configured cards and attempt to re-configure them to make room for the new card.
* The BIOS then scans the standard expansion BIOS memory area looking for the expansion BIOS signatures for Legacy ISA and PnP ISA cards. These are initialised on detection.
* The PCI Configuration Space is examined and PCI devices initialised. As PCI devices are fully configurable by definition, these devices are configured on a first come/first served basis. Again, the last working configuration stored in the ESCD is tried before any attempt to dynamically configure resources.
* If one or more PCI cards can't be configured, an error is generated and the task of configuration is passed to the Configuration Manager.
* The expansion BIOSs are initialised and the ESCD structure updated with the new PCI device configurations - ESCD data for PnP ISA card configurations is carried out by the Configuration Manager.


No comments: