rpms/kernel/F-7 linux-2.6-libata-ahci-enable-ahci-mode-before-reset.patch, NONE, 1.1 linux-2.6-libata-scsi-allow-short-commands.patch, NONE, 1.1 linux-2.6-libata-tape-max-sectors.patch, NONE, 1.1 linux-2.6-libata-use-stuck-err-for-tapes.patch, NONE, 1.1 linux-2.6-libata-work-around-drq-1-err-1-for-tapes.patch, NONE, 1.1 kernel-2.6.spec, 1.3397, 1.3398

Chuck Ebbert (cebbert) fedora-extras-commits at redhat.com
Tue Dec 11 22:08:58 UTC 2007


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22765

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-libata-ahci-enable-ahci-mode-before-reset.patch 
	linux-2.6-libata-scsi-allow-short-commands.patch 
	linux-2.6-libata-tape-max-sectors.patch 
	linux-2.6-libata-use-stuck-err-for-tapes.patch 
	linux-2.6-libata-work-around-drq-1-err-1-for-tapes.patch 
Log Message:
* Tue Dec 11 2007 Chuck Ebbert <cebbert at redhat.com> 2.6.23.9-47
- libata: fix AHCI controller reset
- libata: fix ATAPI tape drives (#243568)
- libata: allow short SCSI commands for ATAPI devices


linux-2.6-libata-ahci-enable-ahci-mode-before-reset.patch:

--- NEW FILE linux-2.6-libata-ahci-enable-ahci-mode-before-reset.patch ---
Combined patch:

bz 411171


Commit:     3cc3eb1148e4b2dfabf7a1dcf36fd8be1331ca95
Parent:     b90fe23bd51c6b1c298159591c833bdd24f55002
Author:     Jeff Garzik <jeff at garzik.org>
AuthorDate: Wed Sep 26 00:02:41 2007 -0400
Committer:  Jeff Garzik <jeff at garzik.org>
CommitDate: Fri Oct 12 14:55:42 2007 -0400

    [libata] AHCI: enable AHCI mode, before using AHCI reset


Commit:     ab6fc95f609b372a19e18ea689986846ab1ba29c
Parent:     360737a982b1ae09e1659e0bb27085c03f02f404
Author:     Jeff Garzik <jeff at garzik.org>
AuthorDate: Mon Oct 29 10:43:55 2007 -0400
Committer:  Jeff Garzik <jeff at garzik.org>
CommitDate: Mon Oct 29 10:43:55 2007 -0400

    [libata] AHCI: fix newly introduced host-reset bug

---
 drivers/ata/ahci.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- linux-2.6.23.noarch.orig/drivers/ata/ahci.c
+++ linux-2.6.23.noarch/drivers/ata/ahci.c
@@ -872,8 +872,16 @@ static int ahci_reset_controller(struct 
 	void __iomem *mmio = host->iomap[AHCI_PCI_BAR];
 	u32 tmp;
 
-	/* global controller reset */
+	/* we must be in AHCI mode, before using anything
+	 * AHCI-specific, such as HOST_RESET.
+	 */
 	tmp = readl(mmio + HOST_CTL);
+	if (!(tmp & HOST_AHCI_EN)) {
+		tmp |= HOST_AHCI_EN;
+		writel(tmp, mmio + HOST_CTL);
+	}
+
+	/* global controller reset */
 	if ((tmp & HOST_RESET) == 0) {
 		writel(tmp | HOST_RESET, mmio + HOST_CTL);
 		readl(mmio + HOST_CTL); /* flush */

linux-2.6-libata-scsi-allow-short-commands.patch:

--- NEW FILE linux-2.6-libata-scsi-allow-short-commands.patch ---
Backport of commit 607126c2a21cd6e9bb807fdd415c1a992f7b9009
libata-scsi: be tolerant of 12-byte ATAPI commands in 16-byte CDBs

---
 drivers/ata/libata-scsi.c |   27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

--- linux-2.6.23.noarch.orig/drivers/ata/libata-scsi.c
+++ linux-2.6.23.noarch/drivers/ata/libata-scsi.c
@@ -2747,16 +2747,15 @@ static inline int __ata_scsi_queuecmd(st
 				      struct ata_device *dev)
 {
 	int rc = 0;
+	u8 scsi_op = scmd->cmnd[0];
 
-	if (unlikely(!scmd->cmd_len || scmd->cmd_len > dev->cdb_len)) {
-		DPRINTK("bad CDB len=%u, max=%u\n",
-			scmd->cmd_len, dev->cdb_len);
-		scmd->result = DID_ERROR << 16;
-		done(scmd);
-		return 0;
-	}
+	if (unlikely(!scmd->cmd_len))
+		goto bad_cdb_len;
 
 	if (dev->class == ATA_DEV_ATA) {
+		if (unlikely(scmd->cmd_len > dev->cdb_len))
+			goto bad_cdb_len;
+
 		ata_xlat_func_t xlat_func = ata_get_xlat_func(dev,
 							      scmd->cmnd[0]);
 
@@ -2764,10 +2763,22 @@ static inline int __ata_scsi_queuecmd(st
 			rc = ata_scsi_translate(dev, scmd, done, xlat_func);
 		else
 			ata_scsi_simulate(dev, scmd, done);
-	} else
+	} else {
+		int len = COMMAND_SIZE(scsi_op);
+		if (unlikely(len > scmd->cmd_len || len > dev->cdb_len))
+			goto bad_cdb_len;
+
 		rc = ata_scsi_translate(dev, scmd, done, atapi_xlat);
+	}
 
 	return rc;
+
+ bad_cdb_len:
+	DPRINTK("bad CDB len=%u, scsi_op=0x%02x, max=%u\n",
+		scmd->cmd_len, scsi_op, dev->cdb_len);
+	scmd->result = DID_ERROR << 16;
+	done(scmd);
+	return 0;
 }
 
 /**

linux-2.6-libata-tape-max-sectors.patch:

--- NEW FILE linux-2.6-libata-tape-max-sectors.patch ---
From: Tony Battersby <tonyb at cybernetics.com>
Date: Tue, 30 Oct 2007 15:44:35 +0000 (-0400)
Subject: libata: increase 128 KB / cmd limit for ATAPI tape drives
X-Git-Tag: v2.6.24-rc2~48^2~6
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=f8d8e5799b75cf7ad530d2bf2a42229bf7360526

libata: increase 128 KB / cmd limit for ATAPI tape drives

Commands sent to ATAPI tape drives via the SCSI generic (sg) driver are
limited in the amount of data that they can transfer by the max_sectors
value.  The max_sectors value is currently calculated according to the
command set for disk drives, which doesn't apply to tape drives.  The
default max_sectors value of 256 limits ATAPI tape drive commands to
128 KB.  This patch against 2.6.24-rc1 increases the max_sectors value
for tape drives to 65535, which permits tape drive commands to transfer
just under 32 MB.

Tested with a SuperMicro PDSME motherboard, AHCI, and a Sony SDX-570V
SATA tape drive.

Note that some of the chipset drivers also set their own max_sectors
value, which may override the value set in libata-core.  I don't have
any of these chipsets to test, so I didn't go messing with them.  Also,
ATAPI devices other than tape drives may benefit from similar changes,
but I have only tape drives and disk drives to test.

Signed-off-by: Tony Battersby <tonyb at cybernetics.com>
Signed-off-by: Jeff Garzik <jeff at garzik.org>
---

---
 drivers/ata/libata-core.c |    4 ++++
 include/linux/ata.h       |    6 ++++++
 2 files changed, 10 insertions(+)

--- linux-2.6.23.noarch.orig/drivers/ata/libata-core.c
+++ linux-2.6.23.noarch/drivers/ata/libata-core.c
@@ -2019,6 +2019,10 @@ int ata_dev_configure(struct ata_device 
 		dev->max_sectors = ATA_MAX_SECTORS;
 	}
 
+	if ((dev->class == ATA_DEV_ATAPI) &&
+	    (atapi_command_packet_set(id) == TYPE_TAPE))
+		dev->max_sectors = ATA_MAX_SECTORS_TAPE;
+
 	if (dev->horkage & ATA_HORKAGE_MAX_SEC_128)
 		dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
 					 dev->max_sectors);
--- linux-2.6.23.noarch.orig/include/linux/ata.h
+++ linux-2.6.23.noarch/include/linux/ata.h
@@ -43,6 +43,7 @@ enum {
 	ATA_MAX_SECTORS_128	= 128,
 	ATA_MAX_SECTORS		= 256,
 	ATA_MAX_SECTORS_LBA48	= 65535,/* TODO: 65536? */
+	ATA_MAX_SECTORS_TAPE	= 65535,
 
 	ATA_ID_WORDS		= 256,
 	ATA_ID_SERNO		= 10,
@@ -430,6 +431,11 @@ static inline int atapi_cdb_len(const u1
 	}
 }
 
+static inline int atapi_command_packet_set(const u16 *dev_id)
+{
+	return (dev_id[0] >> 8) & 0x1f;
+}
+
 static inline int is_atapi_taskfile(const struct ata_taskfile *tf)
 {
 	return (tf->protocol == ATA_PROT_ATAPI) ||

linux-2.6-libata-use-stuck-err-for-tapes.patch:

--- NEW FILE linux-2.6-libata-use-stuck-err-for-tapes.patch ---
Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f442cd86c1c86c5f44bc2cf23f89536f7e4cfe59
Commit:     f442cd86c1c86c5f44bc2cf23f89536f7e4cfe59
Parent:     2d3b8eea7f2fbafd5d779cc92f7aedbd1ef575e9
Author:     Albert Lee <albertcc at tw.ibm.com>
AuthorDate: Thu Nov 15 10:35:47 2007 +0900
Committer:  Tejun Heo <htejun at gmail.com>
CommitDate: Mon Nov 19 12:28:11 2007 +0900

    libata: use ATA_HORKAGE_STUCK_ERR for ATAPI tape drives
    
    Per Mark's comments, maybe all ATAPI tape drives need ATA_HORKAGE_STUCK_ERR.
    This patch applys ATA_HORKAGE_STUCK_ERR for all ATAPI tape drives.
    
    Signed-off-by: Albert Lee <albertcc at tw.ibm.com>
    Cc: Mark Lord <liml at rtr.ca>
    Signed-off-by: Tejun Heo <htejun at gmail.com>
---
 drivers/ata/libata-core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- linux-2.6.23.noarch.orig/drivers/ata/libata-core.c
+++ linux-2.6.23.noarch/drivers/ata/libata-core.c
@@ -2020,8 +2020,10 @@ int ata_dev_configure(struct ata_device 
 	}
 
 	if ((dev->class == ATA_DEV_ATAPI) &&
-	    (atapi_command_packet_set(id) == TYPE_TAPE))
+	    (atapi_command_packet_set(id) == TYPE_TAPE)) {
 		dev->max_sectors = ATA_MAX_SECTORS_TAPE;
+		dev->horkage |= ATA_HORKAGE_STUCK_ERR;
+	}
 
 	if (dev->horkage & ATA_HORKAGE_MAX_SEC_128)
 		dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,

linux-2.6-libata-work-around-drq-1-err-1-for-tapes.patch:

--- NEW FILE linux-2.6-libata-work-around-drq-1-err-1-for-tapes.patch ---
Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2d3b8eea7f2fbafd5d779cc92f7aedbd1ef575e9
Commit:     2d3b8eea7f2fbafd5d779cc92f7aedbd1ef575e9
Parent:     21bef6dd2b419f28c8096a8e30ad86dcbff44c02
Author:     Albert Lee <albertcc at tw.ibm.com>
AuthorDate: Thu Nov 15 10:35:46 2007 +0900
Committer:  Tejun Heo <htejun at gmail.com>
CommitDate: Mon Nov 19 12:28:11 2007 +0900

    libata: workaround DRQ=1 ERR=1 for ATAPI tape drives
    
    After an error condition, some ATAPI tape drives set DRQ=1 together
    with ERR=1 when asking the host to transfer the CDB of the next packet
    command (i.e. request sense).  This patch, a revised version of
    Alan/Mark's previous patch, adds ATA_HORKAGE_STUCK_ERR to workaround
    the problem by ignoring the ERR bit and proceed sending the CDB.
    
    Signed-off-by: Albert Lee <albertcc at tw.ibm.com>
    Cc: Alan Cox <alan at lxorguk.ukuu.org.uk>
    Cc: Mark Lord <liml at rtr.ca>
    Signed-off-by: Tejun Heo <htejun at gmail.com>
---
 drivers/ata/libata-core.c |   18 +++++++++++++-----
 include/linux/libata.h    |    1 +
 2 files changed, 14 insertions(+), 5 deletions(-)

--- linux-2.6.23.noarch.orig/drivers/ata/libata-core.c
+++ linux-2.6.23.noarch/drivers/ata/libata-core.c
@@ -4962,11 +4962,19 @@ fsm_start:
 		 * let the EH abort the command or reset the device.
 		 */
 		if (unlikely(status & (ATA_ERR | ATA_DF))) {
-			ata_port_printk(ap, KERN_WARNING, "DRQ=1 with device "
-					"error, dev_stat 0x%X\n", status);
-			qc->err_mask |= AC_ERR_HSM;
-			ap->hsm_task_state = HSM_ST_ERR;
-			goto fsm_start;
+			/* Some ATAPI tape drives forget to clear the ERR bit
+			 * when doing the next command (mostly request sense).
+			 * We ignore ERR here to workaround and proceed sending
+			 * the CDB.
+			 */
+			if (!(qc->dev->horkage & ATA_HORKAGE_STUCK_ERR)) {
+				ata_port_printk(ap, KERN_WARNING,
+						"DRQ=1 with device error, "
+						"dev_stat 0x%X\n", status);
+				qc->err_mask |= AC_ERR_HSM;
+				ap->hsm_task_state = HSM_ST_ERR;
+				goto fsm_start;
+			}
 		}
 
 		/* Send the CDB (atapi) or the first data block (ata pio out).
--- linux-2.6.23.noarch.orig/include/linux/libata.h
+++ linux-2.6.23.noarch/include/linux/libata.h
@@ -306,6 +306,7 @@ enum {
 	ATA_HORKAGE_NONCQ	= (1 << 2),	/* Don't use NCQ */
 	ATA_HORKAGE_MAX_SEC_128	= (1 << 3),	/* Limit max sects to 128 */
 	ATA_HORKAGE_BROKEN_HPA	= (1 << 4),	/* Broken HPA */
+	ATA_HORKAGE_STUCK_ERR	= (1 << 9),	/* stuck ERR on next PACKET */
 
 	 /* DMA mask for user DMA control: User visible values; DO NOT 
 	    renumber */


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-7/kernel-2.6.spec,v
retrieving revision 1.3397
retrieving revision 1.3398
diff -u -r1.3397 -r1.3398
--- kernel-2.6.spec	11 Dec 2007 18:10:46 -0000	1.3397
+++ kernel-2.6.spec	11 Dec 2007 22:08:03 -0000	1.3398
@@ -596,6 +596,11 @@
 Patch665: linux-2.6-libata-pata_serverworks-fix-drive-combinations.patch
 Patch666: linux-2.6-ppc-pegasos-via-ata-legacy-irq.patch
 Patch667: linux-2.6-libata-correct-iordy-handling.patch
+Patch671: linux-2.6-libata-tape-max-sectors.patch
+Patch672: linux-2.6-libata-work-around-drq-1-err-1-for-tapes.patch
+Patch673: linux-2.6-libata-use-stuck-err-for-tapes.patch
+Patch674: linux-2.6-libata-scsi-allow-short-commands.patch
+Patch675: linux-2.6-libata-ahci-enable-ahci-mode-before-reset.patch
 
 Patch680: linux-2.6-wireless.patch
 Patch681: linux-2.6-wireless-pending.patch
@@ -1282,6 +1287,15 @@
 ApplyPatch linux-2.6-libata-pata_serverworks-fix-drive-combinations.patch 
 # fix libata IORDY handling
 ApplyPatch linux-2.6-libata-correct-iordy-handling.patch
+# fix ATA tape drives
+ApplyPatch linux-2.6-libata-tape-max-sectors.patch
+ApplyPatch linux-2.6-libata-work-around-drq-1-err-1-for-tapes.patch
+ApplyPatch linux-2.6-libata-use-stuck-err-for-tapes.patch
+# allow 12-byte SCSI commands for ATAPI devices
+ApplyPatch linux-2.6-libata-scsi-allow-short-commands.patch
+# fix ahci reset
+ApplyPatch linux-2.6-libata-ahci-enable-ahci-mode-before-reset.patch
+
 # post-2.6.23 wireless patches from upstream
 ApplyPatch linux-2.6-wireless.patch
 # pre-2.6.25 wireless patches from upstream
@@ -2278,6 +2292,11 @@
 %endif
 
 %changelog
+* Tue Dec 11 2007 Chuck Ebbert <cebbert at redhat.com> 2.6.23.9-47
+- libata: fix AHCI controller reset
+- libata: fix ATAPI tape drives (#243568)
+- libata: allow short SCSI commands for ATAPI devices
+
 * Wed Dec 05 2007 John W. Linville <linville at redhat.com> 2.6.23.9-45
 - Update wireless bits from current upstream (resync w/ F-8)
 - Drop patch to use "old format" firwmare for b43 (unmaintainable)




More information about the fedora-extras-commits mailing list