VideoPortGetDeviceBase

PVOID VideoPortGetDeviceBase(

    PVOID HwDeviceExtension,
   PHYSICAL_ADDRESS IoAddress,
   ULONG NumberOfUchars,
   UCHAR InIoSpace
  );

VideoPortGetDeviceBase maps a range of bus-relative device memory or I/O addresses into the system (kernel) address space.

Parameters

HwDeviceExtension

Points to the miniport driver’s device extension.

IoAddress

Specifies the base physical address of the range to be mapped. This is a bus-relative value obtained by calling VideoPortGetBusData, VideoPortGetDeviceData, VideoPortGetRegistryParameters, or VideoPortGetAccessRanges, or else this value is a driver-supplied default base address for the device memory or I/O ports. However obtained, the range described by IoAddress and NumberOfUchars must have been successfully claimed in the registry with a preceding call to VideoPortVerifyAccessRanges or VideoPortGetAccessRanges.

NumberOfUchars

Specifies the number of bytes, starting at the given IoAddress, to be mapped.

InIoSpace

Specifies that the range is in system I/O space if the value is TRUE. FALSE indicates that the range is in memory space.

Return Value

VideoPortGetDeviceBase returns a mapped logical base address suitable for use with the VideoPortReadXxx, VideoPortWriteXxx, and all VideoPort..Memory functions except VideoPortMapMemory and VideoPortUnmapMemory. If the given bus-relative range cannot be mapped, it returns NULL.

Comments

After VideoPortGetDeviceBase has performed the mapping, the miniport driver can communicate with its adapter by calling the VideoPortRead/WriteXxx functions, using the mapped logical addresses. A miniport driver also must use mapped logical addresses to call VideoPortCompareMemory, VideoPortMoveMemory, VideoPortZeroDeviceMemory, and VideoPortZeroMemory. VideoPortGetDeviceBase must be called from the miniport’s HwVidFindAdapter, HwVidQueryDeviceCallback, or HwVidQueryNamedValueCallback function.

The mapped base address returned by VideoPortGetDeviceBase and length of the mapped access range should be stored in the HwDeviceExtension for later use before HwVidFindAdapter returns control.

Access to the mapped address space must follow these rules:

·If the input value for InIoSpace is TRUE, indicating that the address is in I/O space, the returned mapped logical address should be used with the VideoPortRead/WritePortXxx and VideoPortRead/WritePortBufferXxx functions where Xxx is one of Uchar, Ushort, or Ulong.

·If the input value for InIoSpace is FALSE, indicating the address is not in I/O space but in memory space, the returned mapped logical address should be used with the VideoPortRead/WriteRegisterXxx and VideoPortRead/WriteRegisterBufferXxx functions, where Xxx is one of Uchar, Ushort, or Ulong.

·The driver must not access addresses outside the range delimited by the given NumberOfUchars.

If a miniport driver finds that it does not support an adapter for which it has mapped a logical range, it must call VideoPortFreeDeviceBase to unmap the previously mapped range from the system address space, and release its claims on the range in the registry with VideoPortGetAccessRanges or VideoPortVerifyAccessRanges, before it returns control to the DriverEntry function.

See Also

HwVidFindAdapter, HwVidQueryDeviceCallback, HwVidQueryNamedValueCallback, VideoPortCompareMemory, VideoPortFreeDeviceBase, VideoPortGetAccessRanges, VideoPortGetBusData, VideoPortGetDeviceData, VideoPortGetRegistryParameters, VideoPortMoveMemory, VideoPortReadXxx, VideoPortVerifyAccessRanges, VideoPortWriteXxx, VideoPortZeroDeviceMemory, VideoPortZeroMemory