Bewerken

Delen via


StorPortAllocateDmaMemory function (storport.h)

This function is the extended version of the StorPortAllocateContiguousMemorySpecifyCacheNode function. It allocates a range of physically contiguous noncached, nonpaged memory, and returns the physical address of the allocated buffer.

Syntax

ULONG StorPortAllocateDmaMemory(
  [in]           PVOID               HwDeviceExtension,
  [in]           SIZE_T              NumberOfBytes,
  [in]           PHYSICAL_ADDRESS    LowestAcceptableAddress,
  [in]           PHYSICAL_ADDRESS    HighestAcceptableAddress,
  [in, optional] PHYSICAL_ADDRESS    BoundaryAddressMultiple,
  [in]           MEMORY_CACHING_TYPE CacheType,
  [in]           NODE_REQUIREMENT    PreferredNode,
  [out]          PVOID               *BufferPointer,
  [out]          PPHYSICAL_ADDRESS   PhysicalAddress
);

Parameters

[in] HwDeviceExtension

A pointer to the hardware device extension for the host bus adapter (HBA).

[in] NumberOfBytes

The number of bytes to allocate.

[in] LowestAcceptableAddress

The lowest physical address that is valid for the allocation. For example, if the device can only reference physical memory in the 8 MB to 16 MB range, this value would be set to 0x800000 (8 MB).

[in] HighestAcceptableAddress

The highest physical address that is valid for the allocation. For example, if the device can only reference physical memory below 16 MB, this value would be set to 0xFFFFFF (16 MB - 1).

[in, optional] BoundaryAddressMultiple

The physical address multiple that this allocation must not cross.

[in] CacheType

The desired cache type for the mapping.

[in] PreferredNode

The preferred node from which the allocation should be made if pages are available on that node.

[out] BufferPointer

The variable that receives the starting address of the allocated memory block. Upon return from this routine, if this variable is zero, a contiguous range could not be found to satisfy the request. If this variable is not NULL, it contains a pointer (for example, a virtual address in the nonpaged portion of the system) to the allocated physically contiguous memory.

[out] PhysicalAddress

Physical address of the allocated memory block.

Return value

This function returns a STOR_STATUS code.

Return code Description
STOR_STATUS_NOT_IMPLEMENTED This function is not implemented on the active operating system.
STOR_STATUS_SUCCESS The operation was successful.
STOR_STATUS_INSUFFICIENT_RESOURCES The operation failed to allocate the requested memory because of insufficient resources.

Remarks

If the request fails, BufferPointer will be set to NULL.

Requirements

Requirement Value
Minimum supported client Windows 10 (Version 1803)
Target Platform Universal
Header storport.h
DDI compliance rules StorPortIrql

See also

StorPortFreeDmaMemory