HwVidFindAdapter Functionality

Every video miniport driver must have at least one HwVidFindAdapter routine. It is possible to have a different HwVidFindAdapter routine for each different I/O bus type. If a driver implements bus specific HwVidFindAdapter routines, the HwFindAdapter member of VIDEO_HW_INITIALIZATION_DATA, in addition to the AdapterInterfaceType of VIDEO_PORT_CONFIG_INFO, must be changed before each call to VideoPortInitialize.

The video port driver fills in as much VIDEO_PORT_CONFIG_INFO as it can from the miniport's VIDEO_HW_INITIALIZATION_DATA before calling its HwVidFindAdapter routine with a pointer to the configuration information buffer. In particular, VideoPortInitialize always sets the following:

·Length to sizeof(VIDEO_PORT_CONFIG_INFO)

·AdapterInterfaceType to the miniport's VIDEO_HW_INITIALIZATION_DATA specification

·SystemIoBusNumber to the system-assigned number of the I/O bus on which the adapter might be attached

This value specifies a particular I/O bus in multibus machines with more than one bus of the given AdapterInterfaceType.

·StartingDeviceNumber to the miniport's VIDEO_HW_INITIALIZATION_DATA specification.

In general, the HwVidFindAdapter function is responsible for the following:

·Determining whether one or more adapters on the given I/O bus are supported by the miniport driver

·Claiming bus-relative access ranges of device memory and other hardware resources (such as interrupt vector, if any) for supported adapter(s) on the I/O bus in the registry

·Mapping bus-relative access ranges to system-space logical addresses to communicate with the adapter(s)

·Filling in all relevant configuration information for each supported adapter in the VIDEO_PORT_CONFIG_INFO buffer

·Setting the registry entries to indicate the chip type, DAC type, memory size, and adapter string for the adapter. See Setting Hardware Information in the Registry for more information.

First, a HwVidFindAdapter function should check whether the Length of the input ConfigInfo buffer has enough room for data that the miniport driver needs to find, configure, and initialize its video adapter. In effect, this is a check on the version of the VIDEO_PORT_CONFIG_INFO structure being used by the port driver.