适配器对象简介Introduction to Adapter Objects

使用直接 i/o 和 DMA 的任何驱动程序都必须创建一个适配器对象。Any driver that uses direct I/O and DMA must create an adapter object. 适配器对象表示 DMA 控制器通道或端口,或者是主线主机设备。The adapter object represents either a DMA controller channel or port, or a bus-master device.

两种最低级别的驱动程序必须使用适配器对象:Two kinds of lowest-level drivers must use adapter objects:

  • 使用系统 DMA 控制器的设备驱动程序。Drivers for devices that use the system DMA controller. 此类设备称为 从属设备 ,称为 "使用系统 (或 从属) DMA"。Such devices are called subordinate devices and are said to "use system (or subordinate) DMA."

  • 作为总线-主适配器的设备的驱动程序。Drivers for devices that are bus-master adapters. 此类设备会使用系统进行仲裁,以使用 i/o 总线,因此使用的是总线主控 DMA。Such devices arbitrate with the system for use of the I/O bus, and thus use bus-master DMA.

驱动程序为指向适配器对象的指针提供存储,通常在设备扩展中。Drivers provide storage, usually in a device extension, for a pointer to the adapter object.

若要执行 DMA 传输,使用这两种 DMA 方法的设备的驱动程序通常具有 AdapterControl 例程,并调用系统提供的支持例程来处理适配器对象。To carry out DMA transfers, drivers of devices that use either of these DMA methods usually have an AdapterControl routine and call system-supplied support routines that manipulate adapter objects. 不需要 AdapterControl 例程的 (驱动程序包括那些 使用散播/聚集 Dma 的驱动程序,以及 使用常见缓冲区、总线主 dma的驱动程序。 ) (Drivers that do not require AdapterControl routines include those that use scatter/gather DMA and those that use common-buffer, bus-master DMA.)

作为设备启动操作的一部分,处理 DMA 操作的驱动程序调用 i/o 管理器,该管理器反过来调用特定于平台的 HAL 来创建一组适配器对象。As part of device start-up operations, drivers that handle DMA operations call the I/O manager, which in turn calls the platform-specific HAL to create a set of adapter objects. 在任何 Windows 平台上,适配器对象集通常包含用于的适配器对象:On any Windows platform, the set of adapter objects usually includes an adapter object for:

  • 从属设备连接到的每个系统 DMA 控制器通道或端口。Each system DMA controller channel or port to which a subordinate device is attached.

  • 计算机中的每个主线主机 DMA 设备。Each bus-master DMA device in the machine.

(适用于支持总线主机 DMA 的 SCSI 设备,SCSI 端口驱动程序为特定于 HBA 的 SCSI 微型端口驱动程序设置适配器对象。(For SCSI devices capable of bus-master DMA, the SCSI port driver sets up adapter objects for HBA-specific SCSI miniport drivers. 微型端口驱动程序的 HwScsiFindAdapter 例程为端口驱动程序提供特定于适配器的数据。 ) The miniport driver's HwScsiFindAdapter routine supplies the port driver with adapter-specific data.)

若要详细了解何时以及如何使用适配器对象和AdapterControl例程,请参阅此部分以及使用 Bus 主 DMASee this section as well as Using Bus-Master DMA for more information about when and how drivers use adapter objects and AdapterControl routines.

为设备驱动程序启用 DMA 重新映射Enabling DMA Remapping for device drivers