The MmMapIoSpace routine maps the given physical address range to nonpaged system space.
PVOID
MmMapIoSpace(
IN PHYSICAL_ADDRESS PhysicalAddress,
IN ULONG NumberOfBytes,
IN MEMORY_CACHING_TYPE CacheType
);
MmMapIoSpace returns the base virtual address that maps the base physical address for the range. If space for mapping the range is insufficient, it returns NULL.
Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.
A driver must call this routine during device start-up if it receives translated resources of type CmResourceTypeMemory. MmMapIoSpace maps the physical address returned in the resource list to a logical address through which the driver can access device registers.
For example, drivers of PIO devices that allocate long-term I/O buffers can call this routine to make such a buffer accessible or to make device memory accessible.
Callers of MmMapIoSpace must be running at IRQL = PASSIVE_LEVEL.
HalAllocateCommonBuffer, HalTranslateBusAddress, MmAllocateContiguousMemory, MmAllocateNonCachedMemory, MmMapLockedPages, MmUnmapIoSpace