1 / 22

How to Write an ATAport Miniport

How to Write an ATAport Miniport. Outline. Current ATA Environment ATAport Solution ATAport Features ATAport Model Best Known Practices. Industry Activities. Many Vendor ATA drivers are Scsiport miniports Creating an inconsistent behavior around ATA command handling

yehudah
Download Presentation

How to Write an ATAport Miniport

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How to Write an ATAport Miniport

  2. Outline • Current ATA Environment • ATAport Solution • ATAport Features • ATAport Model • Best Known Practices

  3. Industry Activities • Many Vendor ATA drivers areScsiport miniports • Creating an inconsistent behavior around ATA command handling • Emphasis on consumer RAID • The introduction of SATA interconnect • Requires new feature support • Has a richer host controller interface • Still uses ATA, which is a duplicate of a significant portion of the ATA driver infrastructure

  4. ATAport Goals • Extensibility • Support innovations in the ATA industry • Compatibility • Accommodates existing andnew hardware • Flexibility • Enables Vendor value add • Diagnosability

  5. ATAport Features • ATA/ATAPI 7 support • Forced Unit Access • Advanced Power Management • SATA support • Support for greater than 2 channels/controller • Support for greater than 2 devices/channel • Command Queuing • Channel-based queuing • Device-based queuing

  6. ATAport Features • Support for Message Signal Interrupts • Provides greater flexibility and stability in interrupts • Hotplug • More granular Power Management control • ATAport provides a flexible miniport interface for vendor value add

  7. ATAport Model: Port Services • Translation of upper OS storage requests into ATA protocol • Automatic Generation of Sense Data for ATA devices • Push model as opposed to a Pull model • Improved IDE Request Block that more accurately maps to the underlying hardware model

  8. ATAport Model: Port Services • Asynchronous device reset management • Hierarchical reset (device and channel) • Asynchronous device power management • Per-channel granularity • Power, resets, queuing, interrupts • I/O is concurrent

  9. ATAport Model: Miniport Capabilities • Negotiation of Device parameters • Transfer mode • Bytes/Sector • Sectors/block • LBA sectors/disk • Removable media • Decide on channel- or device-based command queuing • Control the timeout on a per-request basis • Request the mapping of data buffers on a per request basis • Miniport can participate in the queuing policy • Selection of depth, freezing,retry

  10. ATAport Interface Illustration Default Miniport ATAport Channel 1 Channel 0 Disk Channel Interface Disk Controller Interface Port IO Hardware Pciidex Vendor Miniport BAR CS

  11. Controller Interface ATAport Miniport Driver Entry AtaPortInitializeEx Start Controller AtaControllerIntitialize AdapterControl w/ IdeStart Enumerate Channels AtaControllerChannelEnabled ControllerChannelEnabled ChannelInitialize

  12. Channel Interface ATAport Miniport Initialize Channel ChannelInitialize ChannelInitialize Start Channel AtaChannelControl HwControl w/ IdeStart Configure Devices AtaHwIntitialize HwIntitialize I/O HwBuildIO AtaHwBuildIO AtaHwStartIO HwStartIO AtaHwInterrupt HwInterrupt

  13. Trick: Extensions • Keep track of extensions in global variables • Finding Channel Extensions !devstack 0x8245dbf8 !DevObj !DrvObj !DevExt ObjectName 8246a030 \Driver\disk 8246a0e8 disk 8245c478 \Driver\ACPI 8245ac80 0000008a 8245dbf8 \Driver\msahci 8245dcb0 ataport Channel extension is DevExt +0x84 • Finding the Controller Extension !devstack 0x8245dbf8 !DevObj !DrvObj !DevExt ObjectName 8246a030 \Driver\msahci 8246a0e8PciIde2 8245c478 \Driver\ACPI 8245ac80 0000008a 8245dbf8 \Driver\pci 8245dcb0 NTPNP_PCI0012 Controller Extension is DevExt +0x88 • No device objects during crashdump

  14. Best Known Practices: CrashDump/Hybernate • Creates an unused copy of the miniport at boot time • Has no driver stack, runs single threaded, processes 1 IO at a time • Can be identified by ChannelConfiguration.ChannelMode • Cannot touch PCI config space • Cannot use more than 30KB of uncached extension per channel

  15. Trick: Stalling • AtaPortStallExecution • Spinlocks the CPU for x microseconds • Should not be used for greater than 1 millisecond delays • AtaPortRequestTimer • Causes the port driver to trigger a callback routine after x microseconds • Should be used for greater than 1 millisecond delays • Best when used with multiphase functions • Remember crashdump is single-threaded

  16. Best Known Practices: Memory Allocation • Uncached Extension allocation can only be done during Start Channel • AtaPortGetPhysicalAddress retrieves physical address for: • IRB's data buffer • IRB's IrbExtension • Miniport's uncached extension • SGList Entries and Page Breaks

  17. Best Known Practices: Queuing • Per Channel • Use IDE_UNTAGGED for TargetID on QueueTag function calls • Per Device • Use TargetID on QueueTag function calls • Always, Always pause the queue with AtaPortDeviceBusy when failing an IRB with IRB_STATUS_BUSY

  18. Best Known Practices: Bus Configuration Changes • ChannelEnable is optional and only used to validate the channel • Critical hardware operations should not be done in ChannelEnable • ChannelEnable will only be called during QueryDeviceRelations • Use AtaPortBusChangeDetected to reenumerate a channel • Use AtaPortDeviceArrived and AtaPortDeviceRemoved for device hotplug

  19. Best Known Practices: IO Error Reporting • STATUS_BUSY • Host is busy • Make sure to pause the queues with AtaPortDeviceBusy • SELECTION_TIMEOUT • Device busy • Not necessarily retried • IRB AtaStatus and Error fields • Only valid on Selection_Timeout, and Error

  20. Summary • ATAport is an improved port-miniport interface for ATA-based controllers • ATAport supports the latest ATA and architecture features

  21. Additional Resources • ATA Miniport Interface • Documented in the WDK • List of Specifications • ATA - http://www.t13.org • SATA - http://www.serialata.org • SCSI - http://www.t10.org • AHCI - http://developer.intel.com/technology/serialata/ahci.htm

  22. © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

More Related