VP_STATUS VideoPortGetAccessRanges(
PVOID HwDeviceExtension, | |
ULONG NumRequestedResources, | |
PIO_RESOURCE_DESCRIPTOR RequestedResources, |
/* optional */ |
ULONG NumAccessRanges, | |
PVIDEO_ACCESS_RANGE AccessRanges, | |
PVOID VendorId, | |
PVOID DeviceId, | |
PULONG Slot | |
); |
VideoPortGetAccessRanges retrieves bus-relative configuration information and, if possible, claims these hardware resources in the registry for the caller.
VideoPortGetAccessRanges returns NO_ERROR if it successfully filled in the AccessRanges information or returned configuration information at RequestedResources.
VideoPortGetAccessRanges can be called only from a miniport’s HwVidFindAdapter function.
For most miniport drivers, VideoPortGetAccessRanges can retrieve, verify, and claim the bus-relative access ranges and any interrupt and/or DMA channel/port used by a particular video adapter, while VideoPortVerifyAccessRanges can only verify and claim miniport-specified resources. That is, for all configuration information that it returns, VideoPortGetAccessRanges claims the corresponding hardware resources in the registry for the caller. A miniport driver need not call VideoPortVerifyAccessRanges with the returned bus-relative configuration information, unless the miniport driver attempts to modify any of the returned values.
Each successful call to VideoPortGetAccessRanges or VideoPortVerifyAccessRanges for a particular adapter overwrites the miniport’s preceding claim on hardware resources in the registry.
After a successful call to VideoPortGetAccessRanges, the miniport driver must map the returned bus-relative ranges to logical ranges with VideoPortGetDeviceBase before calling the appropriate VideoPortRead/WriteXxx function to communicate with the adapter.
Usually, the miniport driver of a PCI device should have its HwVidFindAdapter function call VideoPortGetAccessRanges, rather than attempting to manipulate the nondevice-specific PCI_COMMON_CONFIG information returned by a call to VideoPortGetBusData. Such a driver generally can call VideoPortGetAccessRanges with a NULL RequestedResources pointer. The video port driver then uses the PCI bus’s configuration space to determine the resources for the video adapter. Such a miniport can call VideoPortGetAccessRanges with a set of driver-supplied RequestedResources specifications if its original call fails to return valid configuration data for the adapter.
Note that miniport drivers of adapters on other types of I/O buses also can call VideoPortGetAccessRanges. These drivers should call VideoPortGetAccessRanges with a RequestedResources pointer to a driver-supplied array of I/O resource descriptors.
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 VideoPortGetAccessRanges or VideoPortVerifyAccessRanges with the NumAccessRanges parameter set to zero.
HwVidFindAdapter, IoAssignResources, PCI_COMMON_CONFIG, PCI_SLOT_NUMBER, VIDEO_PORT_CONFIG_INFO, VideoPortGetBusData, VideoPortGetDeviceBase, VideoPortSetBusData, VideoPortVerifyAccessRanges