NdisMMapIoSpace (Compact 2013)

3/26/2014

This function maps a given bus-relative "physical" range of device RAM or registers onto a system-space virtual range.

Syntax

NDIS_STATUS NdisMMapIoSpace(
  PVOID* VirtualAddress,
  NDIS_HANDLE MiniportAdapterHandle,
  NDIS_PHYSICAL_ADDRESS PhysicalAddress,
  UINT Length
);

Parameters

  • VirtualAddress
    [out] Pointer to a caller-supplied variable that is set to the converted virtual address if the call is successful.
  • PhysicalAddress
    [in] Specifies the bus-relative base physical address of the device memory range to be mapped.
  • Length
    [in] Specifies the number of bytes to be mapped.

Return Value

Value

Description

NDIS_STATUS_SUCCESS

The device memory range was mapped successfully so the value at VirtualAddress is valid and the mapped range has been claimed in the registry for the network adapter.

NDIS_STATUS_RESOURCE_CONFLICT

An attempt to claim the device memory range in the registry has failed, possibly because another driver has already claimed the range for its device. NdisMMapIoSpace logs an error if this occurs.

NDIS_STATUS_RESOURCES

The memory could not be mapped or sufficient virtual memory could not be allocated.

NDIS_STATUS_FAILURE

Either the bus type or bus number is out of range, or the specified PhysicalAddress and Length are invalid, possibly not within the I/O space of the current platform.

Remarks

This function is called by drivers of NICs that have on-board memory or a bank of device registers appearing in the I/O space of the host. For example, the driver of a network adapter that uses PIO calls NdisMMapIoSpace.

A successful call to NdisMMapIoSpace claims hardware resources in the registry for the driver's network adapter. Therefore, only MiniportInitializeEx functions call NdisMMapIoSpace.

This function sets the variable at VirtualAddress to NULL if it does not return NDIS_STATUS_SUCCESS.

MiniportInitialize gets the PhysicalAddress value either from the driver's Parameters registry key or by calling a bus-type-specific NdisXXX configuration function. The specified physical address range must fall within the I/O space of the current platform. It is a programming error to call this function by using a host physical memory address.

A miniport must call the reciprocal NdisMUnmapIoSpace function to release its claim on system resources if MiniportInitialize subsequently does not initialize the network adapter, if its network adapter is removed from the device, and/or when the driver is unloading.

Requirements

Header

ndis.h

Library

ndis.dll

See Also

Reference

NDIS Mapped Memory Interface
MiniportHaltEx
MiniportInitialize
MiniportInitializeEx
NdisMGetBusData
NdisMUnmapIoSpace
NdisOpenConfigurationEx
NdisReadRegisterUchar
NdisReadRegisterUlong
NdisReadRegisterUshort
NdisWriteRegisterUchar
NdisWriteRegisterUlong
NdisWriteRegisterUshort
NdisMUnmapIoSpace
NdisOpenConfiguration
NdisReadPciSlotInformation