ATA Miniport Nuts and Bolts

Slides:



Advertisements
Similar presentations
Computer Architecture
Advertisements

System Integration and Performance
WDM 드라이버의 기본 구조 What is WDM?
Dr. Rabie A. Ramadan Al-Azhar University Lecture 3
Protocol Configuration in Horner OCS
Uncovering Performance and Interoperability Issues in the OFED Stack March 2008 Dennis Tolstenko Sonoma Workshop Presentation.
Introduction to Plug and Play and Power Management in the Windows Driver Foundation 陳怡碩.
Router Components Semester 2 Chapter 4. Table of Contents More on Components The Show Command Network Neighbor Routers Basic Network Testing.
PC To GT Program Load Shachar Rosenberg Alex Normatov Technion - Digital Lab.
Architectural Support for Operating Systems. Announcements Most office hours are finalized Assignments up every Wednesday, due next week CS 415 section.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Hardware Support for Operating Systems Sunny Gleason Vivek Uppal COM S 414
Figure 1.1 Interaction between applications and the operating system.
Chapter 7 Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats.
2. Methods for I/O Operations
Copyright ©: Nahrstedt, Angrave, Abdelzaher
Bob Griswold Program Manager WDEG Storage Microsoft Corporation
Windows Server 2008 Chapter 6 Last Update
计算机系 信息处理实验室 Lecture 12 I/O System
iSCSI Management and Tuning Shiv Rajpal Senior Development Lead Device and Storage Technologies
The University of New Hampshire InterOperability Laboratory Serial ATA (SATA) Protocol Chapter 10 – Transport Layer.
I/O Systems ◦ Operating Systems ◦ CS550. Note:  Based on Operating Systems Concepts by Silberschatz, Galvin, and Gagne  Strongly recommended to read.
Kumar Rajeev SDET Microsoft Corporation. KMDF does not support HID minidrivers natively due to conflicting KMDF and HID architecture requirements HID.
Windows audio architecture Win MM Application DirectSound Application SysAudio.SYS Kmixer.SYS WinMM.DLLDSound.DLL Device Drive Container USB Device Driver.
NDIS LBFO Miniports (Load Balancing And Failover) Larry Cleeton Program Manager Windows Networking And Communications Microsoft Corporation.
AHCI: ATAport Miniport Example. Outline AHCI Features Goals Basics AHCI ATA Miniport Design Philosophy Memory Structures and Resources Enumeration IO.
How to Add WMI Interfaces to SCSIPort and Storport Miniports
Chapter 5 Section 2 : Storage Networking Technologies and Virtualization.
Interrupts and DMA CSCI The Role of the Operating System in Performing I/O Two main jobs of a computer are: –Processing –Performing I/O manage and.
FINAL MPX DELIVERABLE Due when you schedule your interview and presentation.
1 Lecture 20: I/O n I/O hardware n I/O structure n communication with controllers n device interrupts n device drivers n streams.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS6: Device Management 6.1. Principles of I/O.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
Cisco S2 C4 Router Components. Configure a Router You can configure a router from –from the console terminal (a computer connected to the router –through.
A Critical Analysis of the Windows mLAN Driver Supervisor: Prof. Foss By: Shaun Miles.
A Comparative Study of the Linux and Windows Device Driver Architectures with a focus on IEEE1394 (high speed serial bus) drivers Melekam Tsegaye
Device Drivers CPU I/O Interface Device Driver DEVICECONTROL OPERATIONSDATA TRANSFER OPERATIONS Disk Seek to Sector, Track, Cyl. Seek Home Position.
Concerns about ATAPI devices using SATA bridges Mark Hartney Silicon Image August 19, 2003 T13 document e013131r0.
Virtual Machine Queue Driver Development Sambhrama Mundkur Sr. Software Design Engineer Core Networking
WHDC PowerPoint Template Notes & Handouts
D ISCOVERING IDE D EVICES. IDE OVERVIEW The hard drive controller is responsible for converting signals made by the system CPU to signals that the hard.
1 Presented By: Eyal Enav and Tal Rath Eyal Enav and Tal Rath Supervisor: Mike Sumszyk Mike Sumszyk.
Updates and Common Questions Asked by Simulation Developers Peter Shier Architect Windows Devices and Storage Technologies
T13 E00164R0 Cable Detection Issues in D1410R1 Kent H. Pryor Quantum Corporation December 8, 2000 E00164R0.
1.4 Hardware Review. CPU  Fetch-decode-execute cycle 1. Fetch 2. Bump PC 3. Decode 4. Determine operand addr (if necessary) 5. Fetch operand from memory.
80386DX functional Block Diagram PIN Description Register set Flags Physical address space Data types.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
Bob “GRIZZY” Griswold Senior Program Manager, WHEG Microsoft Corporation.
Changes To The Display Driver Interface In Windows ® XP Erick Smith Development Lead Base OS Drivers Team Microsoft Corporation.
Device Driver Concepts Digital UNIX Internals II Device Driver Concepts Chapter 13.
Different Microprocessors Tamanna Haque Nipa Lecturer Dept. of Computer Science Stamford University Bangladesh.
Input Output Techniques Programmed Interrupt driven Direct Memory Access (DMA)
How to Write an ATAport Miniport
WIFI design Guide based PW620-I b/g ----Hardware section Orin.Zhu August 31 st, 2007.
UDI Architecture In-Depth Robert Lipe UDI Development Team Lead
Amdahl’s Law & I/O Control Method 1. Amdahl’s Law The overall performance of a system is a result of the interaction of all of its components. System.
Hands-On Microsoft Windows Server 2008 Chapter 6 Configuring Windows Server 2008 Printing.
USB The topics covered, in order, are USB background
WHDC PowerPoint Template Notes & Handouts
Direct Attached Storage and Introduction to SCSI
Dr. Michael Nasief Lecture 2
IRQ, DMA and I/O Ports - Introduction -
Direct Attached Storage and Introduction to SCSI
ATA over internet.
Operating Systems Lecture 3.
NVMe.
Chapter 13: I/O Systems.
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

ATA Miniport Nuts and Bolts Michael Xing SDE II Device and Storage Technologies xiaoxing@microsoft.com

Agenda Why ATA Miniport? ATA Port / Miniport Model ATA Port / Miniport Interfaces New Interfaces in Windows 7 Best Practices

Why ATA miniport? Do I need an miniport driver? Controllers supported by inbox drivers Microsoft inbox ATA miniport drivers: atapi.sys – developed for legacy PATA controllers msahci.sys – developed for SATA controllers Consider options other than a driver Special requirements that are not covered by inbox drivers: Your hardware uses ATA protocol but has a different transfer layer or exposes special feature(s) Contact us about feature support before developing your own miniport driver

Why ATA miniport? Which port driver model should I use? Windows versions support ATAport: Vista and later Storport: Server 2003 and later Command protocol selection ATAport / miniport command protocol: ATA Storport / miniport command protocol: SCSI Common ATA functionalities implemented in ATA port driver Such as set device attributes, set transfer mode, etc. Less code in miniport

ATA Port/Miniport Model – Driver Stack Class Driver ATA Port DLLs - ATAport.sys - PCIIDEx.sys ATA Miniport Driver PCI Driver

ATA Port/Miniport Model – Loading Sequence PCIIDEx.sys Create Channel FDO Create Device FDO Load ATA Miniport Load ATAport.sys Create Channel PDO Load Class Driver Create Controller PDO Enumerate Channels Create Device PDO PCI Driver Create Controller FDO Enumerate Devices ATA Controller

ATA Port/Miniport Model – Role of ATA Port Driver I/O translation into ATA protocol I/O queuing with prioritization considered Sense Data generation for ATA devices PnP and power request handling Request to miniport driver in push mode

ATA Port/Miniport Model – Role of ATA Miniport Driver Convert ATA command into final transfer layer package if necessary Send final command to device Monitor interrupt for command completion Negotiate for channel and device parameters Select queue depth Freeze/unfreeze queue according to device status

Port / Miniport Interfaces – General ATAport Default Miniport ATA Port DLLs - ATAport.sys - PCIidex.sys Channel Interface ATA Controller I/O Controller Interface Vendor Miniport ATA Miniport Driver PCIidex

Port / Miniport Interfaces – Miniport Major Routines Controller Interface Routines DriverEntry() AtaAdapterControl() – PnP, power operations AtaControllerChannelEnabled() – Channel is usable or not Channel Interface Routines AtaChannelInitRoutine() – Set routine pointers for channel IdeHwControl() – PnP, power operations IdeHwInitialize() – Device initialization IdeHwBuildIo() – I/O preparation IdeHwStartIo() – Execute the I/O IdeHwInterrupt() – Monitor hardware activities; process I/O completion

Port / Miniport Interfaces - Controller Interfaces ATA Port Processes AtaControllerChannelEnabled() Create Channel PDO AtaAdapterControl() with IdeStart Enumerate Channels DriverEntry() (Set callback function pointers) Start Device (Controller) Add Device - Create Controller FDO Load PCIIDEx.sys Load ATA Miniport Load ATAport.sys AtaPortInitializeEx()

Port / Miniport Interfaces - Channel Interfaces ATA Port Processes IdeHwInterrupt() I/O IdeHwStartIo() Create Device PDO IdeHwBuildIo() Configure Devices IdeHwInitialize() Enumerate Devices IdeHwControl() with IdeStart Start Channel AtaChannelInitRoutine() Add Device – Create Channel FDO

Port / Miniport Interfaces – I/O Interface IDE_REQUEST_BLOCK Contains Structure for ATA TaskFile I/O execute mode – PIO or DMA Data buffer for the I/O Other information needed by Miniport driver to execute the command Status and Error field Usage I/O request Miniport action, such as power down the device // 0x100 - 0x1FF indicate ATA commands #define IRB_FUNCTION_ATA_COMMAND 0x100 #define IRB_FUNCTION_ATA_IDENTIFY 0x101 #define IRB_FUNCTION_ATA_READ 0x102 #define IRB_FUNCTION_ATA_WRITE 0x103 #define IRB_FUNCTION_ATA_FLUSH 0x104 #define IRB_FUNCTION_ATA_SMART 0x105 // 0x200 - 0x2FF indicate ATAPI commands #define IRB_FUNCTION_ATAPI_COMMAND 0x200 #define IRB_FUNCTION_REQUEST_SENSE 0x201 // 0x400-0x4FF indicate miniport commands #define IRB_FUNCTION_MINIPORT_COMMAND 0x400 #define IRB_FUNCTION_ADAPTER_FLUSH 0x401 #define IRB_FUNCTION_SHUTDOWN 0x402 #define IRB_FUNCTION_POWER_CHANGE 0x403 #define IRB_FUNCTION_LUN_RESET 0x404 #define IRB_FUNCTION_MINIPORT_IOCTL 0x405 #define IRB_FUNCTION_POWER_REBOOT 0x406

New Interfaces in Windows 7 System Reboot Notification IRB_FUNCTION_POWER_REBOOT Vendor-Defined Power Management IDE_CONTROL_ACTION – IdeVendorDefined Device Parameter Flags Removable Device Flag – DFLAGS_REMOVABLE_DEVICE FUA Support Flag – DFLAGS_FUA_SUPPORT

Best Practices - Device Parameter Changes Changing removable device flag in Microsoft Miniport driver for SATA controller BOOLEAN AhciHwInitialize ( IN PVOID ChannelExtension, IN OUT PIDE_DEVICE_PARAMETERS DeviceParameters, IN PIDENTIFY_DEVICE_DATA IdentifyData ) { … // 3.1 Removable Device Detect if ((channelExtension->Px->CMD.HPCP) || ((channelExtension->CAP.SXS) && (channelExtension->Px->CMD.ESP))) { // Px->CMD.HPCP indicates that the port is hot-pluggable. (both signal and power cable) // CAP.SXS && Px->CMD.ESP indicates that it's an ESATA port. (only signal cable) DeviceParameters->DeviceCharacteristics |= DFLAGS_REMOVABLE_DEVICE; } return TRUE;

Best Practices – Pause Process AtaPortStallExecution() Spin locks the CPU for x microseconds Less than one millisecond delays Should be used during hibernate or crash dump AtaPortRequestTimer() Causes the port driver to trigger a callback routine after x microseconds Greater than one millisecond delays Best when used with multiphase functions

Best Practices – I/O Error Reporting IRB_STATUS_DEVICE_ERROR Most common I/O error code IRB_STATUS_BUSY Host is busy Make sure to pause the queues with AtaPortDeviceBusy() IRB_STATUS_SELECTION_TIMEOUT Not necessarily retried Port driver may reset the device IRB AtaStatus and Error fields Only valid on IRB_STATUS_DEVICE_ERROR or IRB_STATUS_SELECTION_TIMEOUT

Calls to Action Read “ATA Miniport Drivers” in MSDN http://msdn.microsoft.com/en-us/library/aa508877.aspx Refer to sample code Microsoft Miniport driver for AHCI controller in WDK at src\storage\msahci Ask questions at ATA Miniport Driver Development Forum http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1837&SiteID=1 Contact us about feature support: ataportq@microsoft.com

Resources Related Specifications Related Sessions ATA - http://www.t13.org SATA - http://www.serialata.org AHCI - http://developer.intel.com/technology/serialata/ahci.htm Related Sessions Session Day / Time Storport Drivers from the Ground Up Tues. 8:30-9:30 and Wed. 9:45-10:45 Storport Smorgasboard Tues. 4-5 and Wed. 11-12

Questions ?