GET_SET_DEVICE_DATA routine

The SetBusData routine writes data to the device's bus-specific configuration space.

Syntax

GET_SET_DEVICE_DATA SetBusData;

ULONG SetBusData(
  _In_ PVOID Context,
  _In_ ULONG DataType,
  _In_ PVOID Buffer,
  _In_ ULONG Offset,
  _In_ ULONG Length
)
{ ... }

Parameters

  • Context [in]
    A pointer to interface-specific context information. For this parameter, the caller supplies the value from the Context member of the BUS_INTERFACE_STANDARD structure for the interface.

  • DataType [in]
    The type of bus data to write. For more information, see the discussion of the WhichSpace parameter in IRP_MN_READ_CONFIG.

  • Buffer [in]
    A pointer to the buffer that holds the data to write to the device's bus-specific configuration space.

  • Offset [in]
    The byte offset from the start of the device's bus-specific configuration space at which this write operation begins. For example, if DataType is PCI_WHICHSPACE_CONFIG, this parameter value is an offset from the start of the device's PCI configuration space.

  • Length [in]
    The number of bytes of data to write.

Return value

The SetBusData routine returns the number of bytes of configuration data written if the write operation is successful. If the write operation is unsuccessful, a value of zero is returned.

Remarks

This routine writes the specified number of bytes to a location in the device's PCI configuration space, PCMCIA common memory, or PCMCIA attribute memory.

The interrupt request level (IRQL) at which the SetBusData routine can be called depends on the value of the DataType parameter. The routine can be called only from the IRQLs that are specified in the following table.

DataType value IRQL

PCI_WHICHSPACE_CONFIG

<= DIRQL

PCI_WHICHSPACE_ROM

<= APC_LEVEL

PCCARD_COMMON_MEMORY

PCCARD_COMMON_MEMORY_INDIRECT

<= DISPATCH_LEVEL

PCCARD_ATTRIBUTE_MEMORY

PCCARD_ATTRIBUTE_MEMORY_INDIRECT

<= DISPATCH_LEVEL

PCCARD_PCI_CONFIGURATION_SPACE

<= DIRQL

 

The following remarks apply to drivers for PCI Express (PCIe) virtual functions (VFs) on devices that support the single-root I/O virtualization (SR-IOV) interface:

  • Drivers for PCIe VFs should call the SetBusData routine at IRQL <= APC_LEVEL.

  • To write PCI configuration data for a VF at IRQL = DISPATCH_LEVEL, the driver must issue IRP_MN_WRITE_CONFIG requests.

Requirements

Target platform

Desktop

Header

Ntddk.h (include Ntddk.h)

IRQL

See Remarks section.

See also

BUS_INTERFACE_STANDARD

IRP_MN_READ_CONFIG

IRP_MN_WRITE_CONFIG

 

 

Send comments about this topic to Microsoft