Step 4: Enumerating a PCI Ethernet Controller Driver (Windows CE 5.0)

Send Feedback

In this step of the driver loading process example, the next device discovered by the PCI bus driver during the configuration phase is an Ethernet controller. The PCI bus driver searches the registry under the Drivers\PCI key for a key that contains device identifiers that match the PCI device.

Ethernet Controller Subkey Initial State

The Drivers\PCI registry key has the ConfigEntry value defined, indicating that the device needs configuration in a device-specific way. In this case, NE2000cfg.dll is loaded because ConfigDll is defined. At various points during the configuration progress, the PCI bus driver calls DeviceConfig, defined by ConfigEntry. This driver configuration function provides information about resources required by a device that is not enumerated in the PCI configuration space. These resources must be known while the PCI bus is enumerated so that the resources are accounted for and configured within the PCI bus window and so the PCI-to-PCI bridges are set up properly. The PCI bus driver also performs any device-specific configuration actions at this time.

Another use of the configuration entry point is to configure PCI bridges. Typically, no driver is required for a bridge, but a bridge might be set up with such information as bus latency and bus mastering schemes. You can provide a small configuration DLL to configure the bridge when the PCI bus driver detects the bridge. At that time, the PCI bus driver loads the configuration DLL, calls the ConfigEntry point to configure the bridge, and then unloads the configuration DLL.

Once resources are assigned values, such as MemBase and MemLen, the PCI bus driver calls the ConfigEntry point again with the allocated resource information. The driver's configuration routine is responsible for programming the device to respond to the resources that are allocated.

Once the PCI bus is configured, the PCI bus driver scans the bus again to match devices with registry keys. In this case, the best match is made with the Drivers\PCI\Template\NE2000 key. This registry information is copied to Drivers\PCI\Instance\NE20001 because this is the first instance of this driver found. The PCI bus driver writes resources such as IoBase, IoLen, Irq and SysIntr to the Instance key. If multiple memory or I/O base addresses are required for the device, the MemBase, IoBase, MemLen, and IoLen values are defined as a series of strings instead of as a DWORD.

In the process of enumerating the PCI bus, a second, identical NE2000 device is found. The Template information is copied to Drivers\PCI\Instance\NE20002, and the same process of configuration and resource allocations occurs as it did for the first instance.

In this example, NDIS is aware of the MiniPort value, which is used for indicating the location of a registry key under Comm. This key provides information on which miniport driver to load for the device.

The following registry entry example shows the matching of the NE2000 Template registry key.

[HKEY_LOCAL_MACHINE\Drivers\PCI\Template\NE2000]
    "Dll"="NDIS.dll"
    "ConfigDll"="NE2000cfg.dll"
    "ConfigEntry"="DeviceConfig"
    "Class"=dword:02
    "SubClass"=dword:00
    "ProgIF"=dword:00
    "MiniPort"="NE2000"

Ethernet Controller Subkey Final State

After enumeration, the NE2000 Instance keys look like this:

[HKEY_LOCAL_MACHINE\Drivers\PCI\Instance\NE20001]
    "InstanceIndex"=dword:1
    "Dll"="NDIS.dll"
    "ConfigDll"="NE2000cfg.dll"
    "ConfigEntry"="DeviceConfig"
    "Prefix"="COM"
    "MiniPort"="NE2000"
    "Class"=dword:2
    "SubClass"=dword:0
    "ProgIF"=dword:0
    "VendorID"=dword:10EC
    "DeviceID"=dword:8029
    "RevisionID"=dword:0
    "SubVendorID"=dword:10EC
    "SubSystemID"=dword:8029
    "InterfaceType"=dword:5
    "BusNumber"=dword:2
    "DeviceNumber"=dword:1
    "FunctionNumber"=dword:0
    "IoBase"=dword:D100
    "IoLen"=dword:10
    "Irq"=dword:A
    "SysIntr"=dword:1A

[HKEY_LOCAL_MACHINE\Drivers\PCI\Instance\NE20002]
    "InstanceIndex"=dword:2
    "Dll"="NDIS.dll"
    "ConfigDll"="NE2000cfg.dll"
    "ConfigEntry"="DeviceConfig"
    "Prefix"="COM"
    "MiniPort"="NE2000"
    "Class"=dword:2
    "SubClass"=dword:0
    "ProgIF"=dword:0
    "VendorID"=dword:10EC
    "DeviceID"=dword:8029
    "RevisionID"=dword:0
    "SubVendorID"=dword:10EC
    "SubSystemID"=dword:8029
    "InterfaceType"=dword:5
    "BusNumber"=dword:3
    "DeviceNumber"=dword:1
    "FunctionNumber"=dword:0
    "IoBase"=dword:D200
    "IoLen"=dword:10
    "Irq"=dword:C
    "SysIntr"=dword:1C

See Also

Step 5: Loading Drivers on the PCI Bus | Example: Loading Drivers on the PCI Bus

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.