To remap a memory-space physical address, such as that of the device registers, returned by HalTranslateBusAddress to a virtual address in nonpaged pool, a DriverEntry routine can call MmMapIoSpace.
If such a driver fails to initialize or is subsequently unloaded, it must release this mapping with MmUnmapIoSpace. It also must free the memory it allocated.