Sunday, January 20, 2013

ATA SERIAL PORT RESET



In the IDE architecture for Windows Vista and later versions of Windows, there are four system-supplied IDE drivers:The ATA port driver (Ataport.sys) that manages the controller channelThe default ATA miniport driver (Atapi.sys)The controller driver (Pciidex.sys)The default controller minidriver (Pciide.sys)The ATA port driver and default miniport driver are new for Windows Vista. The controller driver and default controller driver are not new for Windows Vista.In versions of the Microsoft Windows operating system earlier than Windows Vista, vendors could replace the default controller minidriver (Pciide.sys) with a different minidriver that is customized to a particular controller. For more information about the structure of the IDE stack in Windows operating systems earlier than Windows Vista, see IDE Port Driver.In Windows Vista and later versions of Windows that incorporate ATA port drivers into the IDE architecture, vendors can replace Pciide.sys with a vendor-supplied ATA miniport driver. This driver can contain more features than a controller minidriver.An ATA miniport driver can potentially perform two functions: it can serve as both a controller minidriver and a channel miniport driver by supporting two interfaces:Controller interfaceThis interface is required. ATA miniport drivers that implement this interface perform the function of a controller minidriver. This interface enables the ATA miniport driver to control the enumeration of the controller's channels and to configure certain characteristics of the IDE controller, such as timing modes.Channel interfaceThis interface is optional. ATA miniport drivers that implement this interface perform both the function of a controller minidriver and the function of a channel miniport driver. Such drivers provide the ATA port driver with hooks into minidriver routines that manage channel I/O. If an ATA miniport driver does not implement this interface, the system uses a default channel miniport driver to handle channel operations (Atapi.sys).Separating these two interfaces complies with the underlying hardware configuration, improves performance when the channels are operated in parallel, and makes the miniport driver code easier to develop and maintain. Moreover, by separating the interfaces, each channel can have its own instance of the channel miniport driver that enables the port driver to do operations such as bus resets on a per channel basis.The following diagram shows an ATA miniport driver that only implements the controller interface.After the ATA miniport driver initializes the controller interface, the port driver calls miniport driver routines to configure certain characteristics of the controller, but the ATA miniport driver does not handle device or controller I/O. All I/O requests are handled by the ATA port driver and the default channel miniport driver.In most cases, you do not have to implement this kind of vendor minidriver. The default controller minidriver (Pciide.sys) is sufficient to manage most controller hardware.The following diagram shows a configuration in which the vendor-supplied miniport driver functions both as the channel driver and the controller driver.An ATA miniport driver that implements the channel interface exposes controller and channel management routines to the controller driver (Pciidex.sys). For performance reasons, Pciidex.sys passes the channel management entry points to the ATA port driver, and the ATA port driver calls the ATA miniport driver's channel management routines directly without the mediation of Pciidex.sys. The Pciidex.sys driver calls the ATA miniport driver's controller routines. 



The ATA port driver supports a two-tier reset mechanism that resembles, in some respects, the reset mechanism of the Storport driver. For more information about the Storport reset mechanism, see Multi-Tier Reset in Storport.Like the Storport driver, and unlike the SCSI port driver, the ATA port driver avoids resetting the entire bus wherever possible. The ATA port driver first tries to reset an individual LUN by using an IRB with a function value of IRB_FUNCTION_LUN_RESET. If the reset fails, the ATA port driver resets the entire bus.For example, suppose the ATA port driver issues an IRB to reset a LUN after one of the LUN's uncompleted requests times out. In response to this LUN reset, the miniport driver performs a device reset operation, if the hardware supports it, and completes all the outstanding requests on the LUN including the reset IRB. The reset IRB is not timed. Therefore no additional requests will be issued to the LUN if the miniport driver does not complete the reset IRB.If the miniport driver fails the reset IRB (that is, completes the reset IRB with any status other than IRB_STATUS_SUCCESS), the ATA port driver calls the miniport driver's IdeHwReset routine to reset the whole channel. The miniport driver must then complete all the outstanding requests for that channel and perform the necessary operations on the hardware to reset the devices that are attached to that channel.The ATA port driver does not support target resets for devices that have multiple LUNs













No comments:

Post a Comment