Initializing and Calling IDE Minidriver Routines
All IDE controller minidrivers must provide a series of standard routines that implement hardware-specific functionality. The following figure illustrates how an IDE controller minidriver makes its routines available to the controller driver. Note that the PciIdeX library, though conceptually separate from the IDE controller driver as illustrated in the figure that follows, is contained within the controller driver's executable file, pciidex.sys. When a minidriver calls a PciIdeX library routine, it is in fact calling a routine within the controller driver.
The PnP manager loads the IDE controller driver-minidriver, then calls its DriverEntry routine, passing it a pointer to the driver object for the controller driver.
The minidriver's DriverEntry calls the PciIdeXInitialize library routine, passing it a pointer to the minidriver's GetControllerProperties routine.
PciIdeXInitialize stores the pointer to GetControllerProperties in the driver object.
PnP manager dispatches an IRP_MN_START_DEVICE request to the IDE controller driver to start the controller. The IDE controller driver receives the request in its DispatchPnP routine and calls an internal routine that starts the device.
The controller driver retrieves a pointer to GetControllerProperties that is stored in the driver object.
The controller driver calls GetControllerProperties, passing it a pointer to an IDE_CONTROLLER_PROPERTIES structure.
GetControllerProperties loads pointers for a standard set of minidriver routines into IDE_CONTROLLER_PROPERTIES.
Once the minidriver populates the IDE_CONTROLLER_PROPERTIES structure with function pointers that point to the minidriver's routines, the controller driver can call them.
The routines that every minidriver must provide for the controller to call are as follows:
This routine determines whether the indicated channel is enabled.
This routine reports properties of the IDE controller hardware.
This routine indicates whether both channels of its controller can be accessed at once.
This routine returns the best PIO mode and the best DMA mode for each device indicated in XferMode.
This routine indicates which ultra-direct memory access (UDMA) transfer mode is current and which is best for the device.
This routine determines whether I/O can be done by means of DMA.