How Plug and Play Works

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

How Plug and Play Works

In this section

  • Plug and Play Architecture

  • Plug and Play Processes and Interactions

  • Network Ports Used by Plug and Play

  • Related Information

With Plug and Play under Microsoft Windows Server 2003, you can connect a hardware device to your system and leave the job of configuring and starting the device to the operating system. If the device and drivers are not designed to take advantage of Plug and Play, Windows Server 2003 will not be able to automatically configure and start the device. Plug and Play in Windows Server 2003 supports a wide range of devices.

In Windows Server 2003, Plug and Play support is optimized for computers that include an Advanced Configuration and Power Interface (ACPI) BIOS. ACPI devices are defined by the Advanced Configuration and Power Interface (ACPI) Specification, a hardware and software interface specification that combines and enhances the Plug and Play and Advanced Power Management (APM) standards. ACPI devices include low-level system devices such as batteries and thermal zones.

On x86-based computers, the interaction between the BIOS and Plug and Play is dependent on whether the system BIOS or the operating system configures the hardware.

The following table describes the recommended BIOS settings on x86-based systems.

Recommended Plug and Play BIOS Settings on x86-based Systems

Condition Recommended BIOS Setting

Fully compliant ACPI system (ACPI BIOS is present; ACPI Hardware Abstraction Layer (HAL) is installed.)

Windows Server 2003 assigns device resources and ignores BIOS settings. This includes assigning IRQ, DMA, and I/O resources and arbitrating conflicts for all PCI devices.

Non-compliant ACPI system (ACPI BIOS is present; compliance problems prevented ACPI HAL installation.)

The system BIOS assigns device resources prior to loading of the operating system, and the Plug and Play BIOS settings must be set to No/Disabled. If your devices have a static configuration, you must turn the computer off before removing or attaching these devices.

Non-ACPI systems

The system BIOS assigns device resources prior to the loading of the operating system, and the Plug and Play BIOS setting must be set to No/Disabled. If your devices have a static configuration, you must turn the computer off before removing or attaching these devices

Dual-boot Windows Server 2003, Windows Server 2003, and Microsoft Windows 98, or Windows Me operating systems

The Plug and Play BIOS setting must be set to No/Disabled. Disabling Plug and Play in the BIOS is the recommended method to prevent errors that may otherwise occur. For example, if the system check for Plug and Play on a Windows 98 ACPI system passes, the system check for Plug and Play might fail on a Windows Server 2003 system.

Plug and Play detection runs with the logon process and relies on system firmware, hardware, device drivers, and operating system features to detect and enumerate new devices. ACPI firmware provides enhanced features, such as hardware resource sharing. When Plug and Play components are coordinated, Windows Server 2003 can detect new devices, allocate system resources, and install or request drivers with minimal user intervention.

Plug and Play Architecture

The following diagram shows the components that work together to support Plug and Play.

Plug and Play Architecture

Plug and Play Architecture

The kernel-mode Plug and Play Manager maintains central control, directing bus drivers to perform enumeration and configuration and directing device drivers to add a device, start a device, and so on.

For example, Plug and Play Manager can send a request to determine whether a device can be safely paused or removed, and to give the device driver a chance to synchronize outstanding I/O requests to the incoming request. Plug and Play in kernel mode coordinates with Plug and Play in user mode to pause or remove devices that are available for such actions.

Drivers for Plug and Play devices do not assign resources; instead, the requested resources for a device are identified when the device is enumerated. When a device is enumerated, Plug and Play Manager retrieves the requirements for each device during resource allocation. Resources are not dynamically configurable for legacy devices, so Plug and Play Manager assigns resources to legacy devices first.

I/O Manager provides core services for device drivers. It is the kernel-mode component that translates user-mode read and write commands into read and write IRPs. I/O Manager manages all other main operating system IRPs.

The following table describes the components from the previous illustration, Plug and Play Architecture.

Plug and Play Components

Component Description

Hardware Abstraction Layer (HAL)

A component based on the Windows NT operating system that provides platform-specific support for the Windows NT kernel, the I/O Manager, kernel-mode debuggers, and the lowest-level device drivers. The HAL exports routines that abstract platform-specific hardware details about caches, I/O buses, interrupts, and so forth. The HAL provides an interface between the platform's hardware and the system software. For example, the HAL implements a routine to map each device driver's bus-relative device interrupt vector to a system-assigned vector with a corresponding platform-specific hardware priority (DIRQL). The HAL also provides several routines that provide DMA transfer support.

Windows Driver Model (WDM)

Driver files used to communicate between devices and Windows Server 2003 are structured under the Windows Device Model (WDM). The three WDM driver types are bus driver, function driver, and filter driver. WDM drivers must support Plug and Play, Power Management, and Windows Management Instrumentation (WMI).

Plug and Play Manager (Kernel)

Kernel-mode component responsible for determining the hardware resources requested by each device) and assigns resources appropriately. Reconfigures resource assignments when necessary, such as when a new device added to the system requires resources already in use.

The kernel-mode Plug and Play Manager interacts with the user-mode Plug and Play Manager by receiving control requests and notifying the user-mode Plug and Play Manager that a new device is present on the system that needs to be started.

I/O Manager

Subsystem that controls and interacts with all devices on the system and provides routines that drivers can call to have the I/O Manager insert IRPs into the associated device queue.

Power Manager

Component responsible for managing power usage for the system. Power Manager administers the system-wide power policy and tracks the path of power IRPs through the system.

Executive Components

The collection of kernel-mode operating system components. Executive components include executive support, the kernel, Memory Manager, Cache Manager, process structure, interprocess communication (LPC and RPC), Object Manager, I/O Manager, Configuration Manager, and Security Reference Monitor. Each executive component, with the exception of Cache Manager, supplies a specialized set of native system services. Every executive component also exports a set of kernel-mode support routines for use by other executive components.

Plug and Play Manager (User)

User-mode component that interacts with user-mode setup components, such as Class Installers, to configure and install devices, as well as interacting with applications to register notification of device changes or to notify the application when a device event occurs.

The user-mode Plug and Play Manager interacts with the kernel-mode Plug and Play Manager by sending control requests.

Win32 Services

Windows Server 2003 functionality that uses the Win32 API to manage resources on a computer.

Plug and Play Processes and Interactions

The following section describes Plug and Play processes and interactions.

How Plug and Play Detects and Installs a Device

The following diagram shows how Plug and Play detects and installs a device.

Plug and Play Driver Installation Process

Plug and Play Driver Installation Process

When a hardware device is connected — as when you plug a USB camera into a USB port — Plug and Play Manager goes through the following steps to install the device.

  1. After receiving an insertion notification, Plug and Play Manager checks what hardware resources the device needs — such as memory ranges, I/O ranges, and DMA channels. Plug and Play Manager then assigns those resources.

  2. Plug and Play Manager checks the hardware identification number of the device. Plug and Play Manager then checks the hard drive, floppy drives, CD-ROM drives, and Windows Update for drivers that match the hardware identification number of the device.

  3. If multiple drivers are found, Plug and Play Manager chooses the driver that is the best match by looking for the closest hardware ID or compatible ID match, driver signatures, and other driver features.

  4. Plug and Play Manager then installs the best-match driver and the operating system starts the device.

When multiple drivers are available for a given device, Windows Server 2003 uses driver-ranking schemes to determine the best driver to load. Driver rank is established based on whether the driver is signed and how closely the driver's Plug and Play ID matches the device's Plug and Play ID.

If no driver is available on the computer, and the computer is connected to the Internet, then the operating system will use the Windows Update service to search for available drivers on the Windows Update site. If an appropriate driver is found, Windows Server 2003 copies it and installs it on the computer.

Device drivers included with or installed under Windows Server 2003 must meet the standards of the Windows Logo program. Device drivers that have passed the Windows Hardware Quality Lab (WHQL) compatibility tests are electronically signed, and Windows Server 2003 detects the digital signature. For system stability, it is recommended that you use only signed device drivers with Windows Server 2003. A message notifies the user if an unsigned driver is being installed.

The extent of Plug and Play support depends on both the hardware device and the device driver. If a driver does not support Plug and Play, its devices behave as devices that are not Plug and Play. This might result in the loss of some operating system functionality. For example, power management features such as hibernation might not work. Some bus types, such as Peripheral Component Interconnect (PCI) and Universal Serial Bus (USB) take full advantage of Plug and Play. Older bus types, such as Industry Standard Architecture (ISA), do not and require more user interaction to ensure that devices are correctly installed.

For more information about device ranking and device signing, see “Device Driver Technical Reference.”

Plug and Play in Managed Environments

When you install a Plug and Play device and are connected to the Internet, Windows Server 2003 automatically accesses Windows Update to search for a device driver.

In order to install devices using the hardware wizards, you must be logged on as an administrator or a member of the Administrators group. You then use hardware wizards to search the Windows Update site for device drivers.

You can control how administrators update and install hardware devices by using Group Policy. For example, an IT administrator in a highly managed network environment can control the ability of administrators to install new hardware and to access the Internet automatically when Windows Server 2003 searches for device drivers. You can set a policy to disallow any access to Windows Update, preventing certain administrators from automatically accessing Windows Update. You can also set a policy for downloading the updates from the Windows Update Catalog and distributing through a corporate network as needed.

In a managed environment, you can control how Plug and Play operates by changing any or all of the following, including downloading updates from Windows Update:

Specific information sent or received

The Code Download Manager (CDM) calls Windows Update to find and download device drivers. The CDM also calls Help and Support Center, which logs Plug and Play IDs for devices for which Microsoft does not have drivers. Neither of these communications is under the direct control of Plug and Play. The CDM handles all of the communication between the computer and Windows Update. None of this communication between the computer and the Internet uniquely identifies the user.

Plug and Play is enabled by default.

Triggers

A user controls whether to run Windows Update. If Automatic Updates is enabled following setup, it is triggered about once per day when there is an Internet connection.

User notification

When searching for a device driver, Windows Update sends a list of available drivers to the user's computer.

Logging

If you use a Plug and Play driver with a device that is not Plug and Play, any associated issues or problems are recorded in the event log.

Encryption

Data transfer is based on interaction with Windows Update. The data is transferred using HTTPS.

Transmission protocol and ports

The protocol for non-secure transmission is HTTP and the port used is 80; the protocol for secure transmission is HTTPS and the port used is 443.

Ability to disable

Plug and Play cannot be disabled, since system instability would result. You can disable access to Windows Update using Group Policy.

Plug and Play Services

Plug and Play in Windows Server 2003 provides the following services.

  • Detection of a Plug and Play device

  • Determination of hardware resource requirements

  • Determination of device identification number

  • Allocation of hardware resources

  • Dynamic loading, initialization, and unloading of drivers

  • Notification to other drivers and applications when a new device is available

  • Coordination with power management components to install and remove devices

How Plug and Play Detection Occurs on ACPI Systems

  1. The function driver for the bus detects a new device on the bus.

  2. The bus driver notifies Plug and Play Manager that a set of devices has changed.

  3. Plug and Play Manager queries the driver for the current list of devices on the bus.

  4. When Plug and Play Manager obtains the current list of devices, it determines whether any devices have been added or removed.

  5. Plug and Play Manager gathers information about the new device and begins configuring it.

  6. Plug and Play Manager checks the registry to determine whether the device has been installed on the computer before; if not, Plug and Play Manager creates a registry key and any associated subkeys about the device in the registry.

  7. Plug and Play Manager attempts to find and load the function drivers and filter drivers for the device.

  8. Plug and Play Manager assigns resources to the device if needed and issues an I/O request packet (IRP) to start the device.

Plug and Play Device States

The following diagram shows how a device transitions through Plug and Play states as it is configured, started, and stopped.

Plug and Play Device States

Plug and Play Device States

The process illustrated in the previous diagram begins when a device is first recognized as physically present. This is indicated in the diagram above by the box in the upper left labeled “Device is physically present”. Before the a Plug and Play device is recognized as physically present, the device has not yet been identified by the system. This could be because the device has just been inserted into the system; however, the device could have been present at boot time and was not detected then for some reason.

Plug and Play Manager begins configuration of the device by enumerating it, then identifying and initializing the drivers for the device, and then creating and attaching the function driver objects and any optional filter driver objects.

Plug and Play Manager calls a routine to load each driver if the driver is not yet loaded. Once the driver is initialized, it must be ready to initialize the device. When a device receives a request from Plug and Play Manager, the driver starts the device and is ready to process I/O requests for the device.

Upon any changes in the device status, such as the device being physically removed from the system, Plug and Play Manager will reconfigure the hardware resources of the device. If a device is reconfigured, Plug and Play Manager directs the drivers to restart the device.

Removing Devices While the System is Running

Some Plug and Play devices can be installed or removed while the system is running. For example, USB, IEEE 1394, and PC Card devices can be added to and removed from a fully powered system. When such hardware is added or removed, the operating system automatically detects insertion or removal of the device and manages system and device configuration as required. If the device is not designed to be removed while the system is running, it is recommended that you notify the operating system in advance to avoid problems. The Safely Remove Hardware application notifies the operating system that a device will be removed.

The following table shows the different types of Plug and Play devices and whether or not they can be removed while the system is turned on.

Plug and Play Device Connections and Installation Guidelines

Devices on These Buses or Connectors Can Be Added to or Removed from a Running System? System Must be Turned Off Before Device is Added to or Removed from System?

USB, IEEE 1394, PC Card devices, CardBus devices

Yes. Remove hardware by using the Safely Remove Hardware application if it appears in the notification area.

No.

PCI, ISA, EISA

No.

Yes.

Docking station

Varies among computer manufacturers; most support docking and undocking while the computer is running.

Varies among computer manufacturers; most support docking and undocking while the computer is running.

Even when removing a device from a bus that supports the removal of devices while the system is running, it is best to use the Safely Remove Hardware application to ensure a safe removal of hardware from the system. The Safely Remove Hardware application informs Windows that the user intends to remove a device. This gives Windows an opportunity to prepare for the removal by taking steps such as halting data transfers to the device and unloading device drivers. If a device supports safe removal, a Safe Removal icon displays in the notification area next to the task bar. The icon displays a list of the Plug and Play devices supporting safe removal currently attached to the system. If you do not see the icon, the device does not support this feature, and you cannot unplug or eject your device using Safe Removal.

When hardware is removed from a running system without using the Safely Remove Hardware application to notify the operating system in advance of the removal, it is referred to as surprise removal. Surprise removal is particularly a concern for storage devices for which write caching is enabled; when such devices are surprise-removed, data loss or data corruption might occur. To reduce the likelihood of data loss or data corruption due to surprise removal of consumer-oriented storage devices, Windows Server 2003 disables write caching by default for these devices (such as cameras that include IEEE 1394 or USB storage and small-form-factor storage devices such as compact flash). While write caching policy addresses this particular issue, it is recommended that you continue to use the Safely Remove Hardware application when it appears in the notification area. Also, disabling write caching might slow the performance of consumer storage devices.

Write caching is enabled by default for high-performance external storage devices such as IEEE 1394 hard drives and SCSI hard drives and for storage devices inside the computer that cannot be surprise-removed.

How Plug and Play Interoperates with an ACPI BIOS

In Windows Server 2003, Plug and Play support is optimized for computers that include an ACPI BIOS. ACPI devices are defined by the ACPI Specification, a hardware and software interface specification that combines and enhances the Plug and Play and Advanced Power Management (APM) standards. ACPI devices include low-level system devices such as batteries, thermal zones, and other devices defined in a system's ACPI namespace, a hierarchical namespace that an ACPI BIOS uses to reference objects. The ACPI BIOS is responsible for tasks such as describing hardware that is not visible to Plug and Play because the hardware is connected to a bus that does not directly support Plug and Play. For example, the ACPI BIOS describes and helps in configuring devices such as system timers and programmable interrupt controllers on the motherboard, which is not on a bus that supports Plug and Play.

For all Plug and Play features to work on a given system, it must include an ACPI BIOS and hardware devices and drivers that are compliant with Plug and Play. An Advanced Power Management (APM) BIOS or a Plug and Play BIOS does not enable all Plug and Play features and is not as robust as an ACPI BIOS.

Network Ports Used by Plug and Play

The following table describes the port used by Plug and Play when searching Windows Update for the most current device drivers.

Port Assignments for Plug and Play

Service Name UDP TCP

HTTP, IIS

None

80

HTTPS

None

443

The following resources contain additional information that is relevant to this section.