Share via


Loading Device Drivers (Windows Embedded CE 6.0)

1/6/2010

When OEMInit executes, you should start Ethernet debugging, serial debugging, or any other debugging methods. The following locations store resource information for these debugging methods:

  • Boot arguments in the boot loader. Boot arguments provide resource information to set up the hardware in a specific way.
    For example, the interrupt request (IRQ) for the Ethernet debugging adapter may be passed as a boot argument.
  • Hard-coded resource information in the OAL.
  • Resources may be discoverable by the OAL.

Additionally, the registry might contain copies of this resource information. Store copies of this resource information in the registry, if the debugging resources are fixed and known in advance. This allows the Device Manager to load, execute, and then start the I/O Resource Manager, which reads these available resources from the registry.

The OAL might need to configure and enumerate a bus, such as the PCI bus, to operate a device used for debugging services. For example, an Ethernet adapter on the PCI bus that is for Ethernet debugging services needs its resources and intermediary bridges to be configured to be functional. You can ignore other devices because the PCI bus driver performs the configuration and enumeration.

The resource information configures the debugging devices and initializes their associated services. The OAL is responsible for putting this resource information in a registry key and making it accessible to the driver. The OAL uses the Registry Helper Functions to fill out the device's information in a PCI_REG_INFO structure, defined in PCIReg.h. Then, the OS calls KernelIoControl with IOCTL_HAL_INITREGISTRY to enable the helper function PCIReg to be called to populate the registry. This method is preferred, if the debugging resources are selectable at boot time, if they are discovered through bus enumeration, or both.

The Device Manager loads the bus enumerator from HKEY_LOCAL_MACHINE\RootKey where RootKey is a value defined under the HKEY_LOCAL_MACHINE\Drivers key. If the RootKey value is not defined, it defaults to Drivers. Currently, Common.reg sets RootKey equal to Drivers\BuiltIn. This means that the Device Manager looks for the Dll value to load the bus enumerator under HKEY_LOCAL_MACHINE\Drivers\BuiltIn. The bus enumerator, BusEnum.dll, initializes the process of scanning the registry for additional buses and devices to be loaded for subkeys of the RootKey.

Some of the RootKey subkeys describe built-in or possibly fixed ISA buses. The DLL loaded might be BusEnum.dll, or any other bus driver that you choose.

One of the RootKey subkeys might be PCI. Typically, the DLL listed under the PCI key is the PCI bus driver, which is loaded by BusEnum.dll. Registry entries for the PCI bus driver include resources available to the PCI bus. Typically, the HKEY_LOCAL_MACHINE\RootKey\PCI\Order value is set so that the PCI bus driver is loaded last, which allows all of the fixed resources to be allocated before the flexible resources of the PCI devices are configured. Driver registry entries are listed under the PCI key, which represents devices that reside on the PCI bus.

The following table shows the values that PCI bus drivers, with associated physical devices, use or generate.

Subkey Type Description

MemBase

DWORD or MULTI_SZ

Base addresses of memory-mapped I/O.

MemLen

DWORD or MULTI_SZ

Length of memory-mapped ranges corresponding to Membase.

IoBase

DWORD or MULTI_SZ

Base address of port-mapped I/O.

IoLen

DWORD or MULTI_SZ

Length of port-mapped ranges corresponding to IoBase.

InterfaceType

DWORD or MULTI_SZ

Hardware interface type. For more information see INTERFACE_TYPE.

Irq

DWORD or MULTI_SZ

Optional. Logical IRQ numbers.

SysIntr

DWORD or MULTI_SZ

System interrupt numbers corresponding to the IRQs.

The SysIntr value is a mapping of the Irq as specified by the OAL. Some bus drivers, such as the PCI bus driver, generate both the Irq and SysIntr values and write them to the registry. If BusEnum.dll enumerates the registry key, you are required to set the SysIntr value in the appropriate registry file.

Some bus drivers, such as the PCI bus driver, might require additional values. For example, the PCI bus driver has to distinguish between instances of the same device.

The following table shows these additional identification values.

Subkey Type Description

BusNumber

DWORD

PCI bus number of the device.

DeviceNumber

DWORD

Number of the device on the bus.

FunctionNumber

DWORD

Identifies one of the eight possible functions implemented on the device.

After enumerating the registry, the bus enumerator loads drivers for all built-in devices and all bus drivers it recognizes on the system. Bus drivers are subsequently responsible for loading drivers for the devices on their buses. For example, the PCMCIA host controller driver loads drivers for all PC Card client devices.

Device-specific registry keys reside in the appropriate bus driver registry key, not in Device Manager. Bus drivers should load their client drivers and you should update the bus driver registry entries accordingly.

See Also

Reference

ActivateDeviceEx

Concepts

Device Driver Development Concepts
Bus Enumerator

Other Resources

PCI Bus Driver