Attached patch enables my x86 machine to recognize and talk to a "Native 4K" SATA device. When I started working on this, I didn't know Matthew Wilcox had posted a similar patch 2 years ago: http://git.kernel.org/?p=linux/kernel/git/willy/ata.git;a=shortlog;h=refs/heads/ata-large-sectors Gwendal Grignou pointed me at the the above code and small portions of this patch include Matthew's work. That's why Mathew is first on the "Signed-off-by:". I've NOT included his use of a bitmap to determine 512 vs Native for ATA command block size - just used a simple table. And bugs are almost certainly mine. Lastly, the patch has been tested with a native 4K 'Engineering Sample' drive provided by Hitachi GST. Signed-off-by: Matthew Wilcox <matthew.r.wilcox@xxxxxxxxx> Signed-off-by: Grant Grundler <grundler@xxxxxxxxxx> Reviewed-by: Gwendal Grignou <gwendal@xxxxxxxxxx> ---- V1: Gwendal reviewed had concerns about dev->sdev->sector_size which seems to be ok. V2: Matthew Wilcox suggested: o remove comment about Big Endian (already handled) o use "scmd->device->sector_size" instead of "dev->sdev->sector_size" o ata_cmd_ioctl() does PIO data IN and thus should use native size. o add "safe for large sectors" flag in the case that a controller can't tolerate >512byte sector commands. I did NOT add such a flag since I think the right answer would be "Don't attach a Native 4K block device to that controller" - it just won't work. Tejun Heo (and I) prefer to leave ata_cmd_ioctl() hard coded to 512 byte since this ioctl is "should probably be deprecated one day". thanks, grant [ patch NOT inlined because gmail will word-wrap and make a mess of it. Please use attached file.]
Attachment:
2.6.35-libata_4k_block_support-02
Description: Binary data