MmMapIoSpace

PVOID
    MmMapIoSpace(

        IN PHYSICAL_ADDRESS  PhysicalAddress,
        IN ULONG  NumberOfBytes,
        IN BOOLEAN  CacheEnable
        );

MmMapIoSpace maps the given physical address range to nonpaged system space.

Parameters

PhysicalAddress
Specifies the starting physical address of the I/O range to be mapped.
NumberOfBytes
Specifies the number of bytes to be mapped.
CacheEnable
Indicates whether the physical address range can be mapped as cached memory. For device registers, this value usually is FALSE.

Return Value

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.

Comments

Device drivers call this routine during initialization to get a logical address for their device memory if a call to HalTranslateBusAddress indicates that the bus-relative device memory range has been mapped to system memory space.

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.

See Also

HalAllocateCommonBuffer, HalTranslateBusAddress, MmAllocateContiguousMemory, MmAllocateNonCachedMemory, MmMapLockedPages, MmUnmapIoSpace