SCSI_PHYSICAL_ADDRESS
ScsiPortGetPhysicalAddress(
IN PVOID HwDeviceExtension,
IN PSCSI_REQUEST_BLOCK Srb, /* optional */
IN PVOID VirtualAddress,
OUT ULONG *Length
);
ScsiPortGetPhysicalAddress converts a given virtual address range to a physical address range for a DMA operation.
ScsiPortGetPhysicalAddress returns the corresponding physical address for a given VirtualAddress. If the given address cannot be converted, it returns NULL.
Miniport drivers of busmaster HBAs call ScsiPortGetPhysicalAddress to get mapped physical address ranges to be used during DMA operations. For example, ScsiPortGetPhysicalAddress can be used to build a scatter/gather list for data transfers that span pages. Note that the Length returned can be greater than the size of the DataBuffer in a given SRB.
If a nonNULL Srb is passed, the VirtualAddress either must be within the range of the DataBuffer of the SRB or must be a pointer from the SenseInfoBuffer. Otherwise, the given VirtualAddress must be in the miniport’s uncached extension, the SrbExtension, or the SenseInfoBuffer.
A miniport driver can call ScsiPortGetPhysicalAddress to translate an extension address only if that miniport’s DriverEntry routine set NeedPhysicalAddresses to TRUE in the HW_INITIALIZATION_DATA when it called ScsiPortInitialize.
Due to constraints on some buses, such as ISA, the address returned by this routine is not guaranteed to match the address returned by an analogous outside routine (such as MmGetPhysicalAddress). A miniport driver should call only ScsiPortXxx routines to be portable.
HW_INITIALIZATION_DATA, DriverEntry, ScsiPortGetUncachedExtension, ScsiPortGetVirtualAddress, SCSI_REQUEST_BLOCK