Plug-and-play implementation in Windows2000

Source: Internet
Author: User
Tags new set

This article is a thesis of the Operating System Course written by Yang Zhao (software College of Xi'an University of Electronic Science and Technology). According to his introduction, at present, there is almost no information on the principle of plug-and-play on the Internet. He wrote this paper in reference to a Ms document and hoped to be useful to readers.

PNP (Plug and Play, plug-and-play) means that users do not have to intervene in the distribution of system resources by peripheral devices of the computer, but assign this complicated work to the system, the system solves underlying hardware resources. For users, they only need to plug in the peripheral devices and do not need any professional computer knowledge. PNP was first developed jointly by Microsoft and Intel and many other hardware manufacturers. It was mainly used for EISA and MCA bus. However, for various reasons, the above two bus technologies have not been widely recognized. It was not until 1995 that the windows 95 operating system and a variety of popular accessories began to support Plug and Play technology, Plug and Play technology to enter the mainstream market. Initially it was also dubbed plug and pray (plug-and-play prayer), which shows that its initial work was not satisfactory, but after years of improvement, today, users almost take plug-and-play for granted. Recently, the UPnP specification has been approved by the ISO Technical Committee, which means that the famous plug-and-play structure will become an international standard. The following uses Windows2000 as an example to describe the implementation principle and other details of the PNP technology.

First, you should check what you need to do to install a new hardware when no PNP support is available.

In general, when a hardware can be used by the system, a series of interfaces should be provided to the system for the system to decide how to use the device. The allocation of the following resources must be determined, including IRQ (interrupt request interupt request: When the peripheral hardware in the computer needs a processor to perform some work, the hardware sends a hardware signal to notify the processor to work, that is, IRQ) i/O port address: It mainly refers to various interfaces around the minicomputer, such as RS232 port (serial port), parallel port, USB port, and fiber channel interface. DMA (Direct Memory read/write) and memory space allocation problems. These resources should be unique for the same computer, otherwise there will be various conflicts. The system architecture that supports PNP is as follows:

It can be clearly seen that the application of the PNP technology is not unconditional, and the plug-and-play cannot be implemented by operating systems alone. In order to implement the plug-and-play of general hardware, a standard bios, operating system, device, and device driver for plug-and-play is required. All parts are related to the entire architecture. Therefore, the new Windows2000 system and equipment provider provide some different features in the past to meet the needs of plug-and-play technology. (1) The lowest layer is the hardware abstraction layer,In the hardware abstraction layer, a common hardware architecture is a variety of interfaces, such as drivers and resources. It must be allocated. For many systems that do not support plug-and-play, you need to configure the configuration file of the device and understand the current resource allocation of the system to determine the resources used by the newly added hardware. Such a hardware can work normally. For the new PNP architecture, new technologies are used to ensure that all resource scheduling can be completed without human intervention. For systems earlier than Windows 98, it is usually based on advanced power management (APM) or plug-and-play bios, and the effect is not ideal. For Windows, Windows 98/me and later systems, the plug-and-play support is relatively mature, and ACPI (Advanced Configuration and Power Interface) is adopted) specifications serve as the basis for implementing plug-and-play solutions. The ACPI Specification defines a new set of interfaces and power management features. The defined methods are irrelevant to the actual operating system and CPU. It defines a set of register-level interfaces to implement PNP and power management functions and defines a set of descriptive interfaces for hardware features. A) for drivers, since PNP is integrated into the Windows2000 code, this makes the plug-and-play drivers somewhat different from those before: B) the bus driver does not belong to the hardware abstraction layer (HAL) so that it can dynamically work with existing systems. C) the installation and configuration of the device adopt a new method. D) when the device changes, the changes are written to the Registry. It also needs to be read from the Registry to ensure compatibility. It can be found that the proportion of software control is increasing in the system structure, more devices will adopt new control methods and technologies to ensure that they are not a hardware part that is completely "Brainless" after installation. (2) The driver is above the hardware layer, and the key part is the WDM interface. Hardware identification can be said to rely heavily on this part.WDM, Microsoft Win32 Driver Model, supports some new features and control functions for the operating system. The WDM interface is an important component of PNP implementation. It is an architecture provided by the I/O system to the driver. It has the following features. 1. WDM Drivers can be divided into several typesA) bus driver, control bus controller, adapter, bridge or any other device with sub-device. Bus drivers must be driven by Microsoft. On a system, each bus has a bus driver. B) Functional drivers are the main device drivers and provide operable interfaces for their devices. This driver is required. Generally, there are two parts of the driver. One is that Microsoft (usually Microsoft) provides a driver class to provide the functions required by all such devices, and a mini driver that is usually compiled by the device vendor to provide specific features of the device. The plug-and-play manager reads a function driver for each data. C) filter driver. It will sort the I/O requests of the bus, device, or driver class. The filter driver is optional, and can have any number of filters, on the top (or bottom) of the function driver and on the bus driver. Typically, filter drivers are provided by system OEMs or independent hardware vendors. In most cases, the underlying filter driver modifies the hardware behavior of the device. For example, the filter driver of a typical underlying mouse device can provide acceleration to produce non-linear mouse movement data. High-level filter drivers generally provide additional features for devices. For example, the filter driver of the keyboard's high-level device can force an additional security check. 2. WMD Composition of the driver layerFor a given device, there are two or more driver layers: a lower-layer I/O bus driver and a device's function driver. It may also provide one or more filter drivers for the bus or device. 3. WDM Device objectA driver creates a device object for each device it controls. A device object represents the device itself. From the perspective of PNP, there are three device targets: physical device objects, functional device objects, and filter device objects. With these features, Windows can enable its device drivers to comply with WDM standards even when facing a strange device, the basic functions and functions of a device can be quickly identified, and additional drivers provide device-specific functions. Some examples are derived from the class. (3) There is a plug-and-play manager that plays a key role in resource scheduling and allocation.The plug-and-play manager is divided into two parts: the Core mode and the support mode. The plug-and-play manager in the core State mainly maintains the core control command bus driver to enumerate and configure the device, and directs the device driver to add a device and start a device. For example, the plug-and-play manager can send a request to determine whether the device can be safely paused or removed and give the device driver the opportunity to synchronize the highlighted I/O requests. It works with plug-and-play manager copies in user mode to suspend or remove devices. The plug-and-play manager in user mode is different. It mainly manages hardware events and device enumeration. In Windows, the API used to control and configure the plug-and-play environment is actually a 32-bit extended version based on the Configuration Manager API of Windows 95. It provides APIs for managing custom hardware time and creating hardware events. It maintains a device tree that is visible in the Device Manager and contains the activated devices in the system and information about these devices. The plug-and-play Manager updates the Device Tree when devices are added or removed or resources are reassigned. The Device Tree is an inheritance form. The devices on the bus are children of bus adapters or controllers. The Registry is the core static hardware information storage library. Plug-and-play system components and drivers are constructed in the Registry to maintain and access the new or existing subtree. The following figure shows the plug-and-play Device Tree of a hypothetical ACPI system.

In the figure, the LAN adapter and USB master controller are inserted into a PCI bus. An interface of the USB master controller is inserted into a USB hub. From the perspective of plug-and-play, the PCI bus controller, the USB master controller, and the USB hub are both bus devices, because each of them provides a port, and the LAN adapter is not. Note the fdo and PdO in the figure, that is, the functional device object feature device object and the physical device object.   (1) The top-level system provides updated featuresAutomatically and dynamically identifies the installed hardware. Including initial system installation, identifying changes in plug-and-play hardware at system startup, and responding to real-time hardware events, such as inserting or removing devices. Allocate or re-allocate hardware resources. The resources required by plug-and-play devices are not allocated as they used to, but are identified during system enumeration. They are managed and allocated by Plug and Play manager in a unified manner, such as I/O Ports, IRQ, DMA channels, and memory allocation. In addition, the plug-and-play manager will re-allocate resources as needed. Load the appropriate driver. The plug-and-play manager automatically selects to load the appropriate driver. A set of PnP driver interfaces. Interfaces include basic I/O routing, pnp I/O requirement package (IRP), driver entry points, and registry information. Interactive power management. A key feature of PNP and power management is dynamic event processing. Both PNP and power management using WDM functions can respond to dynamic events. Register a device notification event. PNP allows users to register or obtain specific PNP events. For operating systems with such features, hardware installation and identification are more like software installation. Especially dynamic event registration. So that there is no clear limit for the operating system at the upper layer. I, ConclusionIn general, the plug-and-play technology seems complicated, but the core idea is to hand over more work to the software to complete, using a unified architecture, through some redundant information, let the system know how to configure the newly added device. The key technologies are standard device drivers and dynamic resource management technologies. The bus-device structure, which was originally composed of hardware, is now more integrated with software intervention to unify the manual hardware resource configuration process according to certain standards, therefore, it is handed over to computer software for hardware identification and dynamic allocation of resources. This weakens the role of people in hardware configuration and realizes intelligent hardware identification and installation.   II, ReferencesDefinition and translation of Microsoft operating system -- Plug and Play for Windows 2000 White Paper

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.