3.2.3.2 Registering Ports

A miniport must claim any hardware resources it needs to manage an adapter. A miniport, regardless of NIC type, calls NdisMRegisterIoPortRange to claim the I/O port addresses it requires to write to or read from the port using NdisRawWrite(Read)PortXxx. A call to NdisMRegisterIoPortRange does two things:

  1. Claims the I/O port for the NIC in the registry so no other device can use it.

  2. Maps the I/O port so that the miniport can write to and read from the device registers using NdisRawWrite(Read)PortXxx. The NdisRawWrite(Read)Xxx functions cannot be used until NdisMRegisterIoPortRange completes successfully.

If a miniport is not ready to claim an I/O port but simply wants to perform an operation such as checking whether a device is present, the miniport should call NdisImmediateRead(Write)PortXxx. NdisImmediateRead(Write)PortXxx will temporarily claim, map, perform the requested operation and release the port before returning.