Under what conditions does MmMapIoSpace hang?.

I am writing a legacy (non-WDM) driver for a platform that has some (unknown to Windows) devices that the driver is trying to test.

This device has one or more address ranges whose physical addresses are set by BIOS. I can read these physical addresses.

For each range, there are a set of registers(4K bytes long) mapped in this range. I need to access these registers (read and write).

So I am using MmMapIoSpace to map these registers into kernel virtual address space. I am using MmNonCached as the caching attribute.

I have not tried other caching attributes but other caching attributes do not make sense as these registers are not RAM-backed.

When I call MmMapIoSpace, the call does not return. It just hangs (soft hang) and eventually the system BSODs. This is on Win32 XP SP2.

Does anybody have any ideas on why this might be happening?.

Thanks,
RK