SRIOV_GET_VENDOR_AND_DEVICE_IDS callback function (pcivirt.h)

Supplies the Vendor and Device ID for a PCI Express SR-IOV Virtual Function (VF) to be used for generating a more generic Plug and Play ID for the VF. These IDs cannot be read directly from the VF's configuration space.

Syntax

SRIOV_GET_VENDOR_AND_DEVICE_IDS SriovGetVendorAndDeviceIds;

void SriovGetVendorAndDeviceIds(
  [in]  PVOID Context,
  [in]  USHORT VfIndex,
  [out] PUSHORT VendorId,
  [out] PUSHORT DeviceId
)
{...}

Parameters

[in] Context

A pointer to a driver-defined context.

[in] VfIndex

A zero-based index of the VF to which this write operation applies.

[out] VendorId

A pointer to a USHORT variable that is filled with the vendor ID of the VF.

[out] DeviceId

A pointer to a USHORT variable that is filled with the device ID of the VF.

Return value

None

Remarks

This callback function is implemented by the physical function (PF) driver. It is invoked when the system wants to retrieve the vendor and device identifiers of the specified VF.

The PCI Express SR-IOV Specification requires that all VFs have the same Vendor and Device IDs. This is a requirement of compliant hardware. However, it's possible to provision VFs such that their capabilities differ from each other, and it's often useful to load different drivers on different hardware. So Windows allows the PF driver to supply separate Device and Vendor IDs (with different class codes, through the configuration space interfaces) such that each VF may appear with the Plug and Play IDs that are most appropriate for its use.

The PF driver registers its implementation by setting the GetVendorAndDevice member of the SRIOV_DEVICE_INTERFACE_STANDARD, configuring a WDF_QUERY_INTERFACE_CONFIG structure, and calling WdfDeviceAddQueryInterface.

Here is an example implementation of this callback function.

Virtualization_GetVendorAndDevice (
    _In_    PVOID           Context,
    _In_    USHORT          VfIndex,
    _Out_   PUSHORT         VendorId,
    _Out_   PUSHORT         DeviceId
    )
{
    PDEVICE_CONTEXT deviceContext;

    UNREFERENCED_PARAMETER(VfIndex);
    PAGED_CODE();

    deviceContext = (PDEVICE_CONTEXT)Context;

    *VendorId = deviceContext->VendorId;
    *DeviceId = deviceContext->DeviceId;
}

Requirements

Requirement Value
Minimum supported client Windows 10
Minimum supported server Windows Server 2016
Target Platform Windows
Header pcivirt.h
IRQL PASSIVE_LEVEL