StorPortGetDeviceBase function (storport.h)

The StorPortGetDeviceBase routine maps an I/O address to system address space.

Syntax

STORPORT_API PVOID StorPortGetDeviceBase(
  [in] PVOID                 HwDeviceExtension,
  [in] INTERFACE_TYPE        BusType,
  [in] ULONG                 SystemIoBusNumber,
  [in] STOR_PHYSICAL_ADDRESS IoAddress,
  [in] ULONG                 NumberOfBytes,
  [in] BOOLEAN               InIoSpace
);

Parameters

[in] HwDeviceExtension

A pointer to the hardware device extension. This is a per HBA storage area that the port driver allocates and initializes on behalf of the miniport driver. Miniport drivers usually store HBA-specific information in this extension, such as the state of the HBA and the mapped access ranges for the HBA. This area is available to the miniport driver immediately after the miniport driver calls StorPortInitialize. The port driver frees this memory when it removes the device.

[in] BusType

Specifies the interface type of the I/O bus on which the HBA is connected. The miniport driver's HwStorFindAdapter routine obtains the value for this parameter from the AdapterInterfaceType member of the input PORT_CONFIGURATION_INFORMATION.

[in] SystemIoBusNumber

Specifies the system-assigned number of the I/O bus on which the HBA is connected. The HwStorFindAdapter routine obtains the value for this parameter from the SystemIoBusNumber member of the input PORT_CONFIGURATION_INFORMATION.

[in] IoAddress

Specifies the bus-relative base address of a range used by the HBA. The HwStorFindAdapter routine obtains the value for this parameter from one of the AccessRanges elements in the PORT_CONFIGURATION_INFORMATION if the port driver supplies range-configuration information. Otherwise, this address can be a value returned by StorPortGetBusData or a miniport driver-supplied default value. Avoid using a base address of zero because its successful return status can conflict with the error status (NULL).

[in] NumberOfBytes

Specifies the size in bytes of the range that the mapping should cover. The HwStorFindAdapter routine obtains the value of this parameter from the same AccessRanges element as IoAddress if the port driver supplies range configuration information. Otherwise, this value can be returned by StorPortGetBusData or a miniport driver-supplied default. In any case, the driver must not access the hardware outside of the returned, mapped range.

[in] InIoSpace

TRUE indicates the range to be mapped is in I/O space, and the miniport driver will pass mapped addresses in this range to the Storport port read/write routines to communicate with the HBA. The HwStorFindAdapter routine obtains the value of this parameter from the same AccessRanges element as IoAddress. Note that a miniport driver must invert the value of the InMemorySpace member in an ACCESS_RANGE-type element before it is passed to StorPortGetDeviceBase as the InIoSpace argument. FALSE indicates that the range to be mapped is in memory space.

Return value

A mapped, logical base address corresponding to the bus-relative address supplied in the IoAddress parameter.

Remarks

Every miniport driver must pass mapped, logical access range addresses to the Storport port read/write routines and the Storport register read/write routines when communicating with its HBA(s).

This routine supports only those addresses that were assigned to the driver by the system Plug and Play (PnP) manager.

Requirements

Requirement Value
Target Platform Universal
Header storport.h (include Storport.h)
Library Storport.lib

See also

StorPortFreeDeviceBase