Setting up Video Adapter Access Ranges

An array of VIDEO_ACCESS_RANGE-type elements describes one or more ranges of I/O ports and/or memory used by a video adapter. Each element specifies a set of registers or I/O ports the adapter will respond to and that the HwVidFindAdapter routine will attempt to communicate with. Each access range element in this access ranges array contains bus-relative “physical” address values. The driver must claim, and have an entry for, any port or range of ports that the adapter will respond to.

A miniport driver also must map each bus-relative physical address range, that the software must communicate with, in its access ranges array to a system logical address range with VideoPortGetDeviceBase in order to communicate with an adapter. The HAL can remap bus-relative access range values to system-space logical address ranges, particularly in multiple bus machines.

Every video miniport driver must define the bus-relative access ranges for its device, either as statically allocated memory in the driver’s code or on the stack. Except for miniport drivers, such as VGA-compatible SVGA miniports, that use PC standard address ranges for video memory, most miniport drivers set up their video access ranges on the stack.

If HwVidFindAdapter cannot get bus-relative access ranges information by calling VideoPortGetBusData, VideoPortGetAccessRanges, or from the registry with VideoPortGetDeviceData or VideoPortGetRegistryParameters, the miniport should have a set of bus-relative default values for access ranges.

If a miniport’s access ranges are externally configurable, the installation program sets up access ranges for the adapter in the registry. Such a miniport’s HwVidFindAdapter routine can call VideoPortGetRegistryParameters with a miniport-supplied HwVidQueryValueCallback routine that will process information retrieved from the registry. For more information about registry functions, see Registry HwVidXxx Callbacks.

If possible, video miniport drivers should try to auto-detect their adapters, rather than depending on configuration utilities. Doing this is required for the autodetection of adapter features during installation using a setup script.

The HwVidFindAdapter function must always call VideoPortVerifyAccessRanges or VideoPortGetAccessRanges successfully before it calls VideoPortGetDeviceBase.

Note that HwVidFindAdapter must call either VideoPortVerifyAccessRanges or VideoPortGetAccessRanges before the miniport attempts to initialize an adapter on the I/O bus specified by the SystemIoBusNumber in the input VIDEO_PORT_CONFIG_INFO. If VideoPortVerifyAccessRanges or VideoPortGetAccessRanges returns an error status, which indicates a resource conflict, the HwVidFindAdapter function can call again with another set of access ranges if the adapter can be configured at different addresses. Otherwise, it should propagate the returned status and return control immediately.

Note also that the HwVidFindAdapter function can claim a small set of access ranges for an adapter, use this set to determine whether the adapter is one that the miniport supports, and claim a full set of access ranges for a supported adapter with another call to VideoPortGetAccessRanges or VideoPortVerifyAccessRanges. Each successful call to these VideoPort..AccessRanges routines for a particular adapter overwrites the caller’s previous claims in the registry.

Every HwVidFindAdapter function must map claimed bus-relative device memory ranges with VideoPortGetDeviceBase before the miniport attempts to communicate with an adapter on a given I/O bus. VideoPortGetDeviceBase returns a system-space, logical base address for a mapped range that the driver can pass in calls to the VideoPortReadXxx and VideoPortWriteXxx to determine whether an adapter it supports is present in the machine. Such a returned logical address also can be passed to VideoPortCompareMemory, VideoPortMoveMemory, VideoPortZeroDeviceMemory, and/or VideoPortZeroMemory.