Microsoft KB Archive/320917

= How To Populate the Registry at OEMInit Time to Inform the PCIbus Driver About Pre-configured Devices =

Article ID: 320917

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Windows CE .NET 4.2
 * Microsoft Windows CE Platform Builder 4.0

-



This article was previously published under Q320917



SUMMARY
When you use any device (for example, a debug device or a Kernel Independent Transport Layer [KITL] transport device), the PCIbus configuration routine assumes the following about the device:
 * The device is already configured.
 * The instance registry information of the device is complete and reflects its status and location.

If the device is programmatically configured during boot-up (either by the boot loader or at OEMInit time), the configuration information must be written to the registry.

This step-by-step article describes how you can populate the registry by using the PCIReg helper library and the Kernel input/output (I/O) control IOCTL_HAL_INITREGISTRY.



MORE INFORMATION
The IOCTL_HAL_INITREGISTRY Kernel I/O control and the PCIreg helper library allow the original equipment manufacturer (OEM) to write out PCI instance information to the registry for pre-configured devices before the PCIbus driver runs.

To explain how to populate the registry, this article uses the example of the DDB5476 EDBG Ethernet adapter.

 Provide the transport to the host:

You can use the DDB5476 onboard Intel 21143 Ethernet adapter to provide the KITL debug transport to the host. You cannot interrupt the adapter's service by re-configuring the adapter while the PCIbus is configuring and enumerating the PCI bus devices. The boot loader pre-configures the adapter, and then the OEM adaption layer (OAL) enumerates the adapter and populates the registry with this information to allow the PCIbus to recognize that the adapter is pre-configured. This way, the PCIbus does not try to configure the adapter, and does not interfere with its operation. After you start Windows CE .NET, the process continues as follows:  The OEMInit function calls the PCIbusInit routine from the %_WINCEROOT%\platform\ddb5476\kernel\hal\pci.c file. The PCIbusInit routine fills out the PCI_COMMON_CONFIG structure with the adapter's configuration register information. PCIbusInit uses PCI_COMMON_CONFIG to initialize the G_EDBGINFO structure by calling the PCIInitInfo function, which is part of PCIreg.lib.

NOTE: G_EDBGINFO is of type PCI_REG_INFO, the definition of which is found in:

%_WINCEROOT%\public\common\oak\inc\PCIreg.h

You can find the source code for PCIreg.lib in:

%_WINCEROOT%\public\common\oak\drivers\helper\PCIreg

 G_EDBGINFO is finally filled out with the memory and I/O base address of the adapter, and with the registry path for the PCI instance key of this device. When PCIbusInit is called, the registry is not yet available. After the file system has been initialized, and before allowing any process access to the registry, Filesys.exe invokes the Kernel I/O control IOCTL_HAL_INITREGISTRY to allow the OAL the first opportunity to modify the registry.</li> In this example, the IOCTL_HAL_INITREGISTRY I/O control (%_WINCEROOT\platform\ddb5476\kernel\hal\oemioctl.c) invokes the PCIreg.lib helper function, PCIReg, to write the contents of the G_EDBGINFO structure to the registry key that is indicated in the structure.</li></ol> </li></ol>

Keywords: kbhowto KB320917

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.