VideoPortVerifyAccessRanges

VP_STATUS VideoPortVerifyAccessRanges(

PVOID HwDeviceExtension,
ULONG NumAccessRanges,
PVIDEO_ACCESS_RANGE AccessRanges
);

VideoPortVerifyAccessRanges checks the registry for whether another driver has already claimed ownership of the specified bus-relative access ranges and any other hardware resources specified in the VIDEO_PORT_CONFIG_INFO structure. If not, this function claims the given resources for the caller.

Parameters

HwDeviceExtension

Points to the miniport driver's device extension.

NumAccessRanges

Specifies the number of elements in the AccessRanges array.

AccessRanges

Points to the minport driver's access ranges array. Each VIDEO_ACCESS_RANGE-type element in this array specifies a bus-relative range of device memory, I/O ports, or register addresses for the adapter.

Return Value

VideoPortVerifyAccessRanges returns one of the following values:

Value Meaning
NO_ERROR The given AccessRanges are valid and have been claimed for use by the caller.
ERROR_INVALID_PARAMETER An error occurred or a conflict was found; that is, another driver has already claimed one or more of the given hardware resources for its device.

Comments

Every video miniport driver either must call VideoPortVerifyAccessRanges or use access ranges returned by VideoPortGetAccessRanges before attempting to access a video adapter during the driver (and system) initialization process.

VideoPortVerifyAccessRanges can be called only by a miniport's HwVidFindAdapter function.

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

The HwVidFindAdapter function should try to obtain bus-relative access range information by calling VideoPortGetBusData or VideoPortGetAccessRanges, or by checking the registry through calls to VideoPortGetDeviceData or VideoPortGetRegistryParameters. If HwVidFindAdapter cannot get this information, 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 function can call VideoPortGetRegistryParameters with a miniport-supplied HwVidQueryNamedValueCallback function that processes information retrieved from the registry.

HwVidFindAdapter must not pass any access range addresses to VideoPortGetDeviceBase unless it calls VideoPortVerifyAccessRanges or VideoPortGetAccessRanges first and the respective function returns NO_ERROR.

VideoPortVerifyAccessRanges can be called again if the initial AccessRanges specification or value in the VIDEO_PORT_CONFIG_INFO, such as an interrupt vector, causes it to return an ERROR_XXX indicating that another driver has already claimed the resource(s).

If VideoPortVerifyAccessRanges returns NO_ERROR, a subsequent call for the same adapter overwrites the miniport's claim on resources for that adapter in the registry.

Note that a miniport driver cannot communicate with its video adapter, except by using mapped addresses returned by VideoPortGetDeviceBase with the VideoPortRead/WriteXxx functions.

If the HwVidFindAdapter function claims bus-relative access ranges and possibly other hardware resources for an adapter but then determines that it does not support the adapter, the miniport driver must erase its claims on hardware resources in the registry by calling VideoPortVerifyAccessRanges or VideoPortGetAccessRanges with the NumAccessRanges parameter set to zero.

To erase claims on a subset of claimed access ranges that the miniport is no longer using, do the following:

1.Modify the AccessRanges specification for the adapter so that each element describing a range to be released still has RangeStart set to the bus-relative base of a claimed range but RangeLength reset to zero.

2.Call VideoPortVerifyAccessRanges with this modified AccessRanges array.

See Also

HwVidFindAdapter, HwVidQueryDeviceCallback, HwVidQueryNamedValueCallback, VIDEO_ACCESS_RANGE, VIDEO_PORT_CONFIG_INFO, VideoPortGetAccessRanges, VideoPortGetBusData, VideoPortGetDeviceBase, VideoPortGetDeviceData, VideoPortGetRegistryParameters