Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932123Ab0HQR5G (ORCPT ); Tue, 17 Aug 2010 13:57:06 -0400 Received: from smtp-out.google.com ([74.125.121.35]:63228 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751718Ab0HQR46 (ORCPT ); Tue, 17 Aug 2010 13:56:58 -0400 DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=mime-version:date:message-id:subject:from:to:cc: content-type:x-system-of-record; b=AJNcqkbrkaUN2N3FG2MRBNuclBkvRb2Cq7RTp7zsaoCqXEuH17hsFdrN6/kMjDGYM OXzSeiHyuiu4Wgr5uRtDA== MIME-Version: 1.0 Date: Tue, 17 Aug 2010 10:56:53 -0700 Message-ID: Subject: [PATCH] V2 2.6.35 libata support for > 512 byte sectors (e.g. 4K Native) From: Grant Grundler To: Jeff Garzik , Tejun Heo Cc: Linux IDE , Gwendal Grignou , LKML , Matthew Wilcox , Matthew Wilcox Content-Type: multipart/mixed; boundary=0016e64604eea9c94b048e08ac06 X-System-Of-Record: true Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 13818 Lines: 212 --0016e64604eea9c94b048e08ac06 Content-Type: text/plain; charset=UTF-8 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 Signed-off-by: Grant Grundler Reviewed-by: Gwendal Grignou ---- 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.] --0016e64604eea9c94b048e08ac06 Content-Type: application/octet-stream; name="2.6.35-libata_4k_block_support-02" Content-Disposition: attachment; filename="2.6.35-libata_4k_block_support-02" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gcz1i9mj0 ZGlmZiAtLWdpdCBhL2RyaXZlcnMvYXRhL2xpYmF0YS1zY3NpLmMgYi9kcml2ZXJzL2F0YS9saWJh dGEtc2NzaS5jCmluZGV4IGE1NDI3M2QuLmQxMDhhYjkgMTAwNjQ0Ci0tLSBhL2RyaXZlcnMvYXRh L2xpYmF0YS1zY3NpLmMKKysrIGIvZHJpdmVycy9hdGEvbGliYXRhLXNjc2kuYwpAQCAtNTIsNyAr NTIsNiBAQAogCiAjaW5jbHVkZSAibGliYXRhLmgiCiAKLSNkZWZpbmUgU0VDVE9SX1NJWkUJCTUx MgogI2RlZmluZSBBVEFfU0NTSV9SQlVGX1NJWkUJNDA5NgogCiBzdGF0aWMgREVGSU5FX1NQSU5M T0NLKGF0YV9zY3NpX3JidWZfbG9jayk7CkBAIC01MTYsNyArNTE1LDcgQEAgaW50IGF0YV9jbWRf aW9jdGwoc3RydWN0IHNjc2lfZGV2aWNlICpzY3NpZGV2LCB2b2lkIF9fdXNlciAqYXJnKQogCW1l bXNldChzY3NpX2NtZCwgMCwgc2l6ZW9mKHNjc2lfY21kKSk7CiAKIAlpZiAoYXJnc1szXSkgewot CQlhcmdzaXplID0gU0VDVE9SX1NJ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IGF0YV9pZF9oYXNfbGJhNDgoY29uc3QgdTE2 ICppZCkK --0016e64604eea9c94b048e08ac06-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/