Bewerken

Delen via


BUS_INTERFACE_STANDARD structure (wdm.h)

The BUS_INTERFACE_STANDARD interface structure enables device drivers to make direct calls to parent bus driver routines. This structure defines the GUID_BUS_INTERFACE_STANDARD interface.

Syntax

typedef struct _BUS_INTERFACE_STANDARD {
  USHORT                 Size;
  USHORT                 Version;
  PVOID                  Context;
  PINTERFACE_REFERENCE   InterfaceReference;
  PINTERFACE_DEREFERENCE InterfaceDereference;
  PTRANSLATE_BUS_ADDRESS TranslateBusAddress;
  PGET_DMA_ADAPTER       GetDmaAdapter;
  PGET_SET_DEVICE_DATA   SetBusData;
  PGET_SET_DEVICE_DATA   GetBusData;
} BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;

Members

Size

The size, in bytes, of this structure.

Version

The driver-defined interface version.

Context

A pointer to interface-specific context information.

InterfaceReference

A pointer to an InterfaceReference routine that increments the interface's reference count.

InterfaceDereference

A pointer to an InterfaceDereference routine that decrements the interface's reference count.

TranslateBusAddress

A pointer to a TranslateBusAddress routine that translates addresses on the parent bus to logical addresses.

GetDmaAdapter

A pointer to a GetDmaAdapter routine that returns a DMA adapter structure (DMA_ADAPTER) for the target device.

SetBusData

A pointer to a SetBusData routine that writes data to the device's configuration space.

GetBusData

A pointer to a GetBusData routine that reads data from the device's configuration space.

Remarks

The BUS_INTERFACE_STANDARD structure is an extension of the INTERFACE structure.

Some operations on a device are reserved for the device's parent bus driver. These operations might include accessing the device-specific configuration space of a bus or programming a DMA controller.

To read from or write to a device's configuration space, a device driver must rely on the agency of the bus driver in either of two ways:

  • By sending the I/O request packets (IRPs) IRP_MN_READ_CONFIG and IRP_MN_WRITE_CONFIG to the bus driver.

  • By obtaining an interface from the bus driver. The device driver can then access its device's configuration space by making direct calls to the bus driver routines provided by the BUS_INTERFACE_STANDARD interface structure. Its member routines, GetBusData and SetBusData, can be used to read from and write to a device's configuration space, respectively.

For more information about the ways to access configuration space, see Accessing Device Configuration Space.

Some types of devices, such as a bus-mastering storage device, have on-board DMA controllers. However, the device drivers for these devices cannot program these DMA controllers directly. Instead they must rely on routines provided by the parent bus driver. For a device driver to program the DMA controller for its device, it must first request an adapter object from the parent bus driver. The adapter object contains the routines supplied by the bus driver that can be used to program the device's DMA controller. Device drivers must rely on the BUS_INTERFACE_STANDARD, either directly or indirectly, to obtain the adapter object.

If the driver is executing at IRQL = PASSIVE_LEVEL, it should obtain a device's DMA adapter object by calling IoGetDmaAdapter. IoGetDmaAdapter detects whether the bus driver supports the BUS_INTERFACE_STANDARD interface. If it does, IoGetDmaAdapter calls the routine pointed to by the GetDmaAdapter member of this interface to obtain the adapter object. Otherwise, IoGetDmaAdapter calls an equivalent legacy routine.

However, if a driver must obtain an adapter object while running at IRQL >= DISPATCH_LEVEL, it cannot do so with IoGetDmaAdapter. In this case, the driver must query for the BUS_INTERFACE_STANDARD interface while still at IRQL = PASSIVE_LEVEL by using IRP_MN_QUERY_INTERFACE.

Requirements

Requirement Value
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)

See also

DEVICE_DESCRIPTION

DMA_ADAPTER

GUID_BUS_INTERFACE_STANDARD

GetBusData

GetDmaAdapter

INTERFACE

IRP_MN_QUERY_INTERFACE

IRP_MN_READ_CONFIG

IRP_MN_WRITE_CONFIG

InterfaceDereference

InterfaceReference

IoGetDmaAdapter

SetBusData

TranslateBusAddress