SATA AHCI Driver GSoC - Update

by amaneureka | July 25, 2016


Short Brief
Supported Features:
UnSupported Features:
  • Fatal Error Handling
  • NCQ : Native Command Queuing
  • Cache and Priority Requests

Driver Testing
Platform: Virtual Machine (Vmware)
Operating System: Windows Server 2003 x86 Free Build

Device Management Window
devmgmt vm
Detected Devices: "2 3 SCSI Disk Driver"
2, 3 are actually faked VendorId and Product ID, Please refer to code for more detail.

Vmware Settings Tab
vm settings

Disk Management
Though windows is not able to detect NTFS formatted partition (Disk 2, Partition 1) maybe because It was expecting a write support first. So, I tried to dump partition and compared it with raw virtual hard disk file(VHD) dump, So Reading Feature is working perfectly.

Active Disk Editor - VHD mounted image (Host PC, Windows 10)

Active Disk Editor - Win2k3 (Vmware)

Routine: DeviceRequestReadWrite
Description: This Routine Handles Read & Write SRB_FUNCTION_EXECUTE_SCSI Requests, but currently supports Read Request only.
Unsupported Features:
  • NCQ
  • Non Lba48BitMode
  • SectorCount < 0x100
Why not write feature supported?
I am unsure about CommandReg value (considering all cases) and that is why I am not able to program TaskFile for write request, though Routine is perfectly implemented and a correct value of CommandReg will make it work.
on a side note, I tried to set CommandReg = IDE_COMMAND_WRITE_DMA, But It crashed with Fatal Error (TFES : TaskFileErrorStatus != 0)

Routine: DeviceInquiryRequest
Description: This Routine Handles EVPD and VPD Requests.
Unsupported Features:
  • VPD_SERIAL_NUMBER (storport.h)
  • VPD_MEDIA_SERIAL_NUMBER (storport.h)
  • VPD_MODE_PAGE_POLICY (storport.h)
  • VPD_SCSI_PORTS (storport.h)
I don't think we need to support all VPD functions, though right now code assumes only one supported functions but driver will have support for VPD_SERIAL_NUMBER, VPD_MEDIA_SERIAL_NUMBER and VPD_EXTENDED_INQUIRY_DATA in future.

Known Issues
Well, There is only one issue which I was able to find while testing the driver. It is the file system detection, Though It maybe because windows was expecting a write support too, and hence failed to detect filesystem; But I am not really sure on this point so I have better decided to put this into known issue section.

Why no blog?
Well It is known that I didn't made any blog entry for past 3 weeks, Below I have listed the reason
  • Week 6: I was selected for Indian Programming Camp organised by CodeChef, They shortlisted 22 candidates (sport programmers) to join the camp and learn some advance tricks to tackle programming contest's problems. I don't want to miss this oppurtunity so I talked to my mentor and he supported my decision of halting project for few days and join the camp.
    Though I wasn't really inactive on project, I completed Dpc handling routine while traveling and fixed many bugs whenever I got time in camp.
  • Week 7: I was back to home, but interrupt bug actually pissed me, and I was giving 100% of my time in debugging stuffs.
  • Week 8: Well, All bugs were fixed by the end of week 7; But I was little tensed about project timeline so I worked on unsupported feature and decided to create blog entry once I am done with Read Request feature
There is one more reason for not giving any priority to blogs, I hate writing blogs :P