SPB I/O Request Interface
To implement the I/O request interface, SpbCx manages the I/O queue for the SPB controller and monitors this queue for I/O requests from clients of the SPB controller. These clients are user-mode and kernel-mode drivers for SPB-connected peripheral devices. Applications cannot directly communicate with SPB-connected peripheral devices through the SPB I/O request interface.
SpbCx might do all the processing for some of these I/O requests, and do preprocessing of other requests before the requests are passed to the SPB controller driver. The SPB controller driver is responsible for completing the requests that it receives from SpbCx.
Clients can send read and write requests to SPB-connected peripheral devices. In response to an IRP_MJ_READ request, the SPB controller transfers the specified number of bytes from a peripheral device to a client buffer. In response to an IRP_MJ_WRITE request, the SPB controller transfers the specified number of bytes from a client buffer to a peripheral device.
In addition to simple read and write operations, the SpbCx I/O request interface supports I/O transfer sequences, which combine one or more simple transfers (that is, reads and writes) into a single, atomic bus operation. During this operation, the bus is used exclusively for transfers to and from the target peripheral device, and accesses of other targets on the bus are temporarily locked out until the operation completes. SpbCx supports the IOCTL_SPB_EXECUTE_SEQUENCE I/O control code, which a client uses to specify a sequence of fixed-length transfers to and from a target device in a single I/O request. This I/O control request enables the controller driver to optimize a sequence of bus transfers to improve performance.
The SpbCx I/O request interface supports the IOCTL_SPB_LOCK_CONTROLLER and IOCTL_SPB_UNLOCK_CONTROLLER I/O control codes, which lock and unlock the SPB controller. These lock and unlock requests provide another way for a client to perform an I/O transfer sequence. In this case, each read or write operation in the sequence is specified by a separate read or write request. While a client has the controller locked, other clients cannot access devices on the bus. Only the client that holds the lock can perform I/O operations on the bus. For this reason, clients should lock the controller only for brief periods. A client should never leave the controller locked after a transfer sequence completes. For more information, see I/O Transfer Sequences.
In addition to the I/O control (IOCTL) codes that are supported by SpbCx, the SPB controller driver can support custom IOCTLs. Clients can send IOCTL requests to file objects that represent target devices on the bus, and these requests arrive in the I/O request queue that is managed by SpbCx. If SpbCx receives a request that that has an IOCTL code that it does not support, SpbCx passes the request directly to the controller driver, which performs all handling of the request.
Kernel-mode clients of the SpbCx I/O request interface can send I/O requests at an interrupt request level (IRQL) of either PASSIVE_LEVEL or DISPATCH_LEVEL. User-mode clients can send I/O requests only at PASSIVE_LEVEL. I/O completion can occur at PASSIVE_LEVEL or DISPATCH_LEVEL. All I/O requests can return STATUS_PENDING.