Plug and Play Device Detection


Plug and Play in Windows XP Professional provides the following services:

  • Detects a Plug and Play device and determines its hardware resource requirements and device identification number.

  • Allocates hardware resources.

  • Dynamically loads, initializes, and unloads drivers.

  • Notifies other drivers and applications when a new device is available.

  • Works with power management to install and remove devices.

  • Supports a range of device types.

After Windows XP Professional detects a Plug and Play device, the device driver is configured and loaded dynamically, typically without requiring user input. Some buses, such as Peripheral Component Interconnect (PCI) and USB, take full advantage of Plug and Play. Older buses, such as ISA, do not take full advantage of Plug and Play, and require more user interaction to ensure devices are correctly installed.

Plug and Play Detection on ACPI Systems

ACPI is a hardware and software interface specification that combines and enhances the Plug and Play and Advanced Power Management (APM) standards. ACPI also shifts many power management tasks to the operating system.

When a new device is plugged in, the following steps occur:

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

  2. The bus driver notifies Windows Plug and Play that its set of devices has changed.

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

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

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

  6. Windows Plug and Play checks the registry to determine whether the device has been installed on this computer before and if not, it stores information about the device in the registry.

  7. Windows Plug and Play attempts to find and load the function and filter drivers for the device if any exist.

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

For more information about device detection, see the Driver Development Kit (DDK) or the Driver Development Kits link on the Web Resources page at http://www.microsoft.com/windows/reskits/webresources

Plug and Play Detection on Non-ACPI x86-based Systems

On non-ACPI x86-based computers, the system BIOS configures Plug and Play and performs the following steps:

  1. Isolates any Plug and Play ISA devices for configuration.

  2. Builds a map of the resources allocated to non Plug and Play devices.

  3. Maintains a list of previous resource configurations in non-volatile storage or memory.

  4. Selects and enables input and output devices required during the startup process.

  5. Initializes the device ROM if the device is a boot device.

  6. Allocates conflict-free resources to devices that have not yet been configured.

  7. Activates appropriate devices.

  8. Initializes any option ROMs that are detected.

  9. Starts the bootstrap loader.

Allocating System Resources

Each installed device must be allocated a set of operating system resources to operate properly. Some of these resources can be shared, while others cannot, depending upon the capabilities of the hardware and drivers. System resources allow hardware components to gain access to CPU and memory resources without conflicting with each other.

System resources include:

  • Interrupt request (IRQ) lines

  • Direct memory access (DMA)

  • Input/output (I/O) port addresses

  • Memory resources

Windows Plug and Play determines the system resources required by each device and assigns them appropriately. Windows Plug and Play can reconfigure resource assignments as necessary, such as when a new device is added that requires resources that are already in use. It can also detect ISA devices and configure non Plug and Play hardware.

Interrupt Request Lines

IRQ lines are used by hardware devices to communicate with the CPU. The traditional architecture for x86-based computers uses sixteen IRQs (numbered from 0 to 15), some of which are reserved for devices such as the system clock, keyboard, and math co-processor. As new expansion cards are added to the computer, the remaining free IRQs are allocated to these new devices as needed. However, not all devices require IRQs to operate. Certain ISA and PCI multimedia peripherals, for example, do not require use of IRQs. Also, traditional secondary bus types (such as SCSI) and more recent types (such as USB and IEEE 1394) require only a single IRQ regardless of the number of devices connected to the host adapter.

ISA devices that use IRQs require sole access to interrupt lines to function properly, so one interrupt cannot be shared by multiple ISA devices. Because of this restriction, any system that includes ISA devices has a higher likelihood of running out of IRQs. And, once all IRQs are allocated, if a new device is added, it cannot start because no IRQ is available for it to operate. One of the major benefits of PCI over ISA is that PCI allows x86-based systems to share IRQs. Although some problems with IRQ sharing exist, most are related to high-bandwidth devices. Windows XP Professional manages IRQs using a first in, first out (FIFO) stack. The more devices that share a single IRQ, the longer it takes to traverse this stack, which can have a system wide performance impact. Performance problems might be reduced if high-bandwidth devices such as high-speed network adapters and high-end Small Computer Standard Interface (SCSI) controllers, for example, use different IRQs. More flexible interrupt handling models are available on newer x86-based ACPI systems that support the Advanced Programmable Interrupt Controller standard. Systems that incorporate the Advanced Programmable Interrupt Controller have access to more interrupts, which avoids the need to share interrupts.

Most x86-based systems do not support manual configuration of IRQ settings. However, a few do offer this capability as a troubleshooting feature. If you are experiencing problems with system lockups or stability, you have two alternatives:

  1. If your system firmware supports manual configuration of IRQ settings, as a troubleshooting method, try manually assigning IRQs to specific PCI slots by using the configuration options in the BIOS. If you need to manually assign IRQ addresses for an ACPI-compliant computer and the BIOS option to disable ACPI is available, disable ACPI before installing Windows XP Professional. However, remember that it is best not to change the BIOS default or automatic settings unless you have a specific reason to do so.

  2. If your system does not support manual configuration of IRQ settings, try moving high-performance peripherals to another slot.

For more information about PCI devices and IRQ sharing, see article Q252420, General Description of IRQ Sharing in Windows 2000, in the Microsoft Knowledge Base. To find this article, see the Microsoft Knowledge Base link on the Web Resources page at http://www.microsoft.com/windows/reskits/webresources

Caution 

Changing default settings such as IRQs can cause conflicts that might make one or more devices unavailable on the system.

IRQ assignments can be reviewed using Device Manager. For more information about Device Manager, see Device Manager earlier in this chapter.

Direct Memory Access Channels

Direct memory access (DMA) channels allow devices to write and read directly to and from physical memory without placing a load on the CPU. This enhances system performance for devices such as network cards, because the CPU does not need to move blocks of data from memory to a device and back again. For x86-based systems, there are eight DMA channels, with several reserved for certain devices such as the DMA controller and floppy disk drive. Typically, x86-based systems have five or six available DMA channels.

I/O Port Address and Reserved Memory

Data passed between the CPU or RAM and a device must be moved through a dedicated block of memory. I/O port address ranges and memory address ranges denote a reserved area of memory that is dedicated to a specific device. Typically, these memory ranges are determined by the operating system. Manual changes are necessary only in specific cases (when using non Plug and Play ISA hardware, for example).

Safe Removal of Plug and Play Devices

Some buses allow devices to be hot-plugged added or removed while a system is running. Examples of such buses include USB, IEEE 1394, PC Card and CardBus. For devices on other buses, such as ISA and PCI, the computer must be turned off before devices are added or removed.

When removing a device from a bus that supports hot plugging, if the Safely Remove Hardware icon appears in the notification area, use the Safely Remove Hardware application as explained below 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.

When hardware is removed from a running system without using the Safely Remove Hardware application, it is often referred to as surprise removal, because the operating system is not notified in advance of the removal. Surprise removal is particularly a concern for storage devices for which write caching is enabled, because when such devices are surprise removed, data loss or corruption might occur. To reduce the likelihood of data loss or corruption due to surprise removal of consumer oriented storage devices, Windows XP Professional disables write caching by default for these devices (such as cameras that include IEEE 1394 or USB storage, small form factor storage devices such as compact flash, and so on). While write caching policy addresses this particular issue, it is recommended that users 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 oriented storage devices.

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

Caching policy defaults can be changed in Device Manager for high-performance external storage devices. In Device Manager, on the property sheet for the removable storage device click the Policies tab to view the default write caching settings for the device. If the Policies tab does not display, this option is not provided for the device. If the write caching settings are enabled, you can change the settings based on your performance and safe removal needs as follows:

If these write caching options are not enabled, your storage device is not removable without turning off the computer, and a different option displays in the dialog box. This option allows you to disable write caching for your storage device, which can affect the performance of the device.

Users should also inform the operating system before removing a portable computer from a docking station. For more information about docking and undocking procedures, see Supporting Mobile Users in this book.

Safely Remove Hardware Application

Before you remove a device from a bus that supports hot plugging, check to see if the Safely Remove Hardware icon appears in the notification area. If it does, it is recommended that you use the Safely Remove Hardware application to notify the operating system that the device is about to be unplugged.

To notify the operating system about removing a Plug and Play device

  1. Click the Safely Remove Hardware icon in the notification area. The icon displays a notification bubble with a list of devices currently attached to the system.

  2. Click the device you want to remove. The device is stopped and can then be unplugged.




Microsoft Windows XP Professional Resource Kit 2003
Microsoft Windows XP Professional Resource Kit 2003
ISBN: N/A
EAN: N/A
Year: 2005
Pages: 338
BUY ON AMAZON

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net