Partager via


PCI Bus Configuration and Enumeration (Windows Embedded CE 6.0)

1/6/2010

PCI Bus Configuration

First, the PCI bus driver configures the PCI bus, if a boot loader or the system's BIOS have not configured PCI devices before the run-time image is loaded. This step is skipped if the registry value NoConfig is set equal to dword:1 under the PCI registry key.

Note

Skipping the configuration step is useful for CEPCs because the BIOS already configures the PCI bus. Some CEPCs do not configure every possible PCI devices, such as CardBus. For devices to work that are not configured on a CEPC, set NoConfig equal to 1.

Then, the PCI bus driver scans the PCI bus, gathering resource information from the PCI-to-PCI bridges and the devices it finds. As the driver discovers each device, it searches the registry for a matching driver Template or Instance registry key. When it finds the best match, based on device identifiers such as Class, SubClass, VendorID, and so on, the driver examines the corresponding registry key for the presence of the ConfigEntry value. If ConfigEntry exists, the PCI bus driver loads the driver DLL and calls the configuration routine described by ConfigEntry to assist in allocating and placing resources.

Note

If ConfigEntry and ConfigDll values exist, then the DLL described by ConfigDll is loaded instead of the driver DLL. The value of the DLL subkey is the driver DLL. This process is used mainly to configure non-conforming resources, such as resources not in the PCI configuration registers. It is also used to limit the resources required by the device, which is useful for systems with small PCI windows.

Note

This process uses the device configuration functions from Gdcfg.dll. It performs the usual PCI-compliant resource management and provides resource management for the expansion ROM. The PCI bus driver ignores the expansion ROM. For more information about the device configuration functions, see Device Configuration Functions.

When all of the resources are found, including memory and I/O windows, the PCI bus driver places the resources within the PCI bus window. Any devices that were previously placed, such as those used for debugging services, remain as they were, and the PCI bus driver places the resources around them. The PCI bus driver allocates the device IRQ numbers, using the OAL to map the PCI IRQ to the system IRQ. All of the resources allocated to the devices by the PCI bus driver are requested from the I/O Resource Manager to ensure there is no overlap with other built-in devices. For more information, see IOCTL_HAL_REQUEST_SYSINTR.

PCI Bus Enumeration

The PCI bus driver then enumerates the PCI bus by scanning it again. When a device is discovered, the registry is searched for the corresponding Template or Instance key. The PCI bus driver searches for a best match using device identifiers such as Class, SubClass, VendorID, and so on. If an exact match is found with an Instance key, it means the device has already been configured and placed. All devices have an associated Instance key after a warm boot, or if the registry has persisted. If a best match is found with a Template key, the Template information is copied to an Instance key for the driver, along with the configured resource values. If you are using a non-stream driver, the Instance key is the key passed to the driver's entry point when the driver is loaded. If you are not, the Key value under the device's active key is set to the Instance key of the driver.

PCI-to-PCI Bridge Register Configuration

PCI-to-PCI bridges might need to have registers set to configure bus latencies and other board-specific parameters. These are the possibilities for configuring the PCI-to-PCI bridge device:

  • The OAL can enumerate the PCI bus in advance, discover the bridges, and configure the PCI bus appropriately.
  • The PCI bus driver can load a device driver for the bridge to do the configuration, You could load this driver in the configuration routine. After finishing the configuration, the PCI bus driver must unload the device driver that it loaded.

You can also set common PCI configuration registers in the registry for the PCI-to-PCI bridge device. These registers include Command, BridgeControl, Latency, SecondaryLatency, and NoConfig. When NoConfig is set to equal 1, the PCI bus driver does not modify the memory and I/O windows for this PCI-to-PCI bridge.

PCI Bus Driver Registry Enumeration

After the PCI bus is configured and enumerated, the PCI bus driver looks under the Instance key for a Dll value. This DLL, typically BusEnum.dll, enumerates the Instance key to load the device drivers for each of the device instances found on the bus. The bus enumerator loads the device drivers and calls their entry points according to the Order value for each driver instance. If Flags is equal to 0x0001, then the driver does not get loaded. This is useful for reserving and allocating resources for a driver that is already loaded by the OAL, such as the Ethernet debugging adapter. For more information on other valid values Flags, see ActivateDeviceEx.

See Also

Concepts

PCI Bus Driver Development Concepts