Presentation is loading. Please wait.

Presentation is loading. Please wait.

How to Write an ATAport Miniport

Similar presentations


Presentation on theme: "How to Write an ATAport Miniport"— 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 are Scsiport 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 Compatibility Flexibility Diagnosability
Support innovations in the ATA industry Compatibility Accommodates existing and new hardware Flexibility Enables Vendor value add Diagnosability

5 ATAport Features ATA/ATAPI 7 support SATA support Command Queuing
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 Hotplug
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 0 Channel 1 Disk Channel Interface Disk Controller Interface Port IO Pciidex Vendor Miniport Hardware CS BAR

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

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

13 Keep track of extensions in global variables
Trick: Extensions Keep track of extensions in global variables Finding Channel Extensions !devstack 0x8245dbf8 !DevObj !DrvObj !DevExt ObjectName 8246a030 \Driver\disk a0e8 disk 8245c478 \Driver\ACPI ac a 8245dbf8 \Driver\msahci dcb0 ataport Channel extension is DevExt +0x84 Finding the Controller Extension 8246a030 \Driver\msahci a0e8 PciIde2 8245dbf8 \Driver\pci dcb0 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 AtaPortStallExecution
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 List of Specifications
Documented in the WDK List of Specifications ATA - SATA - SCSI - AHCI -

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


Download ppt "How to Write an ATAport Miniport"

Similar presentations


Ads by Google