WdfDeviceMapIoSpace - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdfdevice.h

NTSTATUS WdfDeviceMapIoSpace(
  [in]  WDFDEVICE           Device,
  [in]  PHYSICAL_ADDRESS    PhysicalAddress,
  [in]  SIZE_T              NumberOfBytes,
  [in]  MEMORY_CACHING_TYPE CacheType,
  [out] PVOID               *PseudoBaseAddress
);
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdfdevice-wdfdevicemapiospace)

WdfDeviceMapIoSpace function

Description

[Applies to UMDF only]

The WdfDeviceMapIoSpace function maps the given physical address range to system address space and returns a pseudo base address.

Parameters

Device [in]

A handle to a framework device object.

PhysicalAddress [in]

Specifies the starting 64-bit physical address of the I/O range to be mapped.

NumberOfBytes [in]

Specifies a value greater than zero, indicating the number of bytes to be mapped.

CacheType [in]

Specifies a MEMORY_CACHING_TYPE value, which indicates the cache attribute to use to map the physical address range. The MEMORY_CACHING_TYPE enumeration type is defined in Wdfdevice.h.

PseudoBaseAddress [out]

The address of a location that receives a pointer to the pseudo base address.

Return value

If the operation succeeds, the function returns STATUS_SUCCESS.

The function might return other NTSTATUS values.

Remarks

This function is the UMDF version 2 equivalent of IWDFDevice3::MapIoSpace.

A driver must call this function during device start-up if it receives translated resources of type CmResourceTypeMemory in a CM_PARTIAL_RESOURCE_DESCRIPTOR structure. WdfDeviceMapIoSpace maps the physical address returned in the resource list to a framework-managed address referred to as the pseudo base address.

The driver can then use the pseudo base address to access device registers with WDF_READ_REGISTER_Xxx and WDF_WRITE_REGISTER_Xxx functions.

A driver that calls WdfDeviceMapIoSpace must set the UmdfDirectHardwareAccess INF directive to AllowDirectHardwareAccess.

If the driver sets the UmdfRegisterAccessMode INF directive to RegisterAccessUsingUserModeMapping, calling WdfDeviceMapIoSpace also maps the given physical address range to a user-mode base address range that the driver can subsequently access by calling WdfDeviceGetHardwareRegisterMappedAddress.

For more information about INF directives that UMDF drivers can use, see Specifying WDF Directives in INF Files.

For more information about parsing hardware resources starting in UMDF version 2, see Handling Hardware Resources in a UMDF Driver.

The PHYSICAL_ADDRESS type is defined in Wudfwdm.h, as follows:

typedef LARGE_INTEGER PHYSICAL_ADDRESS;

For an example that shows how a driver finds and maps memory-mapped register resources, see Reading and Writing to Device Registers.

See also

IWDFDevice3::MapIoSpace

WdfDeviceUnmapIoSpace