--- /dev/null
+From stable-bounces@linux.kernel.org Tue Apr 10 10:08:19 2007
+From: Conke Hu <conke.hu@gmail.com>
+Date: Tue, 10 Apr 2007 13:06:56 -0400
+Subject: ahci.c: walkaround for SB600 SATA internal error issue
+To: linux-stable <stable@kernel.org>
+Message-ID: <461BC430.5030602@redhat.com>
+
+From: Conke Hu <conke.hu@gmail.com>
+
+ahci.c: walkaround for SB600 SATA internal error issue
+
+ There is a HW issue in ATI SB600 SATA that PxSERR.E should not be
+set on some conditions, for example, when there is no media in SATA
+CD/DVD drive or media is not ready, AHCI controller fails to execute
+ATAPI commands and reports PORT_IRQ_TF_ERR, but ATI SB600 SATA
+controller sets PxSERR.E at the
+same time, which is not necessary.
+ This patch is just to ignore the INTERNAL ERROR in such case.
+Without this patch, ahci error handler will report many errors as
+below:
+ ----------- cut from dmesg -----------
+ata9: soft resetting port
+ata9: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
+ata9.00: configured for UDMA/33
+ata9: EH complete
+ata9.00: exception Emask 0x40 SAct 0x0 SErr 0x800 action 0x2
+ata9.00: (irq_stat 0x40000001)
+ata9.00: cmd a0/00:00:00:00:20/00:00:00:00:00/a0 tag 0 cdb 0x0 data 0
+ res 51/24:03:00:00:20/00:00:00:00:00/a0 Emask 0x40 (internal error)
+ata9: soft resetting port
+ata9: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
+ata9.00: configured for UDMA/33
+ata9: EH complete
+ata9.00: exception Emask 0x40 SAct 0x0 SErr 0x800 action 0x2
+ata9.00: (irq_stat 0x40000001)
+ata9.00: cmd a0/01:00:00:00:00/00:00:00:00:00/a0 tag 0 cdb 0x43 data 12 in
+ res 51/24:03:00:00:00/00:00:00:00:00/a0 Emask 0x40 (internal error)
+ -------- end cut ---------
+
+Signed-off-by: Conke Hu <conke.hu@amd.com>
+Signed-off-by: Jeff Garzik <jeff@garzik.org>
+Cc: Chuck Ebbert <cebbert@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/ata/ahci.c | 21 +++++++++++++++++++--
+ 1 file changed, 19 insertions(+), 2 deletions(-)
+
+--- a/drivers/ata/ahci.c
++++ b/drivers/ata/ahci.c
+@@ -82,6 +82,7 @@ enum {
+ board_ahci_pi = 1,
+ board_ahci_vt8251 = 2,
+ board_ahci_ign_iferr = 3,
++ board_ahci_sb600 = 4,
+
+ /* global controller registers */
+ HOST_CAP = 0x00, /* host capabilities */
+@@ -173,6 +174,7 @@ enum {
+ AHCI_FLAG_NO_NCQ = (1 << 24),
+ AHCI_FLAG_IGN_IRQ_IF_ERR = (1 << 25), /* ignore IRQ_IF_ERR */
+ AHCI_FLAG_HONOR_PI = (1 << 26), /* honor PORTS_IMPL */
++ AHCI_FLAG_IGN_SERR_INTERNAL = (1 << 27), /* ignore SERR_INTERNAL */
+ };
+
+ struct ahci_cmd_hdr {
+@@ -365,6 +367,18 @@ static const struct ata_port_info ahci_p
+ .udma_mask = 0x7f, /* udma0-6 ; FIXME */
+ .port_ops = &ahci_ops,
+ },
++ /* board_ahci_sb600 */
++ {
++ .sht = &ahci_sht,
++ .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
++ ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
++ ATA_FLAG_SKIP_D2H_BSY |
++ AHCI_FLAG_IGN_SERR_INTERNAL,
++ .pio_mask = 0x1f, /* pio0-4 */
++ .udma_mask = 0x7f, /* udma0-6 ; FIXME */
++ .port_ops = &ahci_ops,
++ },
++
+ };
+
+ static const struct pci_device_id ahci_pci_tbl[] = {
+@@ -404,7 +418,7 @@ static const struct pci_device_id ahci_p
+ { PCI_VDEVICE(JMICRON, 0x2366), board_ahci_ign_iferr }, /* JMB366 */
+
+ /* ATI */
+- { PCI_VDEVICE(ATI, 0x4380), board_ahci }, /* ATI SB600 non-raid */
++ { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 non-raid */
+ { PCI_VDEVICE(ATI, 0x4381), board_ahci }, /* ATI SB600 raid */
+
+ /* VIA */
+@@ -1076,8 +1090,11 @@ static void ahci_error_intr(struct ata_p
+ if (ap->flags & AHCI_FLAG_IGN_IRQ_IF_ERR)
+ irq_stat &= ~PORT_IRQ_IF_ERR;
+
+- if (irq_stat & PORT_IRQ_TF_ERR)
++ if (irq_stat & PORT_IRQ_TF_ERR) {
+ err_mask |= AC_ERR_DEV;
++ if (ap->flags & AHCI_FLAG_IGN_SERR_INTERNAL)
++ serror &= ~SERR_INTERNAL;
++ }
+
+ if (irq_stat & (PORT_IRQ_HBUS_ERR | PORT_IRQ_HBUS_DATA_ERR)) {
+ err_mask |= AC_ERR_HOST_BUS;
--- /dev/null
+From stable-bounces@linux.kernel.org Tue Apr 10 10:10:20 2007
+From: Mark Lord <liml@rtr.ca>
+Date: Tue, 10 Apr 2007 13:09:02 -0400
+Subject: fix lba48 bug in libata fill_result_tf()
+To: linux-stable <stable@kernel.org>
+Message-ID: <461BC4AE.8070304@redhat.com>
+
+From: Mark Lord <liml@rtr.ca>
+
+2.6.21 fix lba48 bug in libata fill_result_tf()
+
+Current 2.6.21 libata does the following:
+
+void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
+{
+ struct ata_ioports *ioaddr = &ap->ioaddr;
+
+ tf->command = ata_check_status(ap);
+ ...
+ if (tf->flags & ATA_TFLAG_LBA48) {
+ iowrite8(tf->ctl | ATA_HOB, ioaddr->ctl_addr);
+ tf->hob_feature = ioread8(ioaddr->error_addr);
+ ...
+ }
+}
+...
+static void fill_result_tf(struct ata_queued_cmd *qc)
+{
+ struct ata_port *ap = qc->ap;
+
+ ap->ops->tf_read(ap, &qc->result_tf);
+ qc->result_tf.flags = qc->tf.flags;
+}
+
+Based on this, those last two statements fill_result_tf()
+appear to me to be in the wrong order, in that the tf->flags
+are uninitialized at the point where tf_read() is invoked.
+So for lba48 commands, tf_read() won't be reading back the
+full lba48 register contents..
+
+Correct?
+
+This patch corrects fill_result_tf() so that the flags
+get copied to result_tf before they are used by tf_read().
+
+Signed-off-by: Mark Lord <mlord@pobox.com>
+Signed-off-by: Jeff Garzik <jeff@garzik.org>
+Cc: Chuck Ebbert <cebbert@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+
+---
+ drivers/ata/libata-core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -4742,8 +4742,8 @@ static void fill_result_tf(struct ata_qu
+ {
+ struct ata_port *ap = qc->ap;
+
+- ap->ops->tf_read(ap, &qc->result_tf);
+ qc->result_tf.flags = qc->tf.flags;
++ ap->ops->tf_read(ap, &qc->result_tf);
+ }
+
+ /**
--- /dev/null
+From stable-bounces@linux.kernel.org Wed Apr 4 12:30:18 2007
+From: Suleiman Souhlal <suleiman@google.com>
+Date: Wed, 04 Apr 2007 15:28:52 -0400
+Subject: ide: use correct IDE error recovery
+To: linux-stable <stable@kernel.org>
+Message-ID: <4613FC74.5010706@redhat.com>
+
+From: Suleiman Souhlal <suleiman@google.com>
+
+ide: use correct IDE error recovery
+
+IDE error recovery is using IDLE IMMEDIATE if the drive is busy or has DRQ set.
+This violates the ATA spec (can only send IDLEÂ IMMEDIATE when drive is not
+busy) and really hoses up some drives (modern drives will not be able to
+recover using this error handling). The correct thing to do is issue a SRST
+followed by a SET FEATURES command. This is what Western Digital recommends
+for error recovery and what Western Digital says Windows does.  It also does
+not violate the ATA spec as far as I can tell.
+
+Bart:
+* port the patch over the current tree
+* undo the recalibration code removal
+* send SET FEATURES command after checking for good drive status
+* don't check whether the current request is of REQ_TYPE_ATA_{CMD,TASK}
+ type because we need to send SET FEATURES before handling any requests
+* some pre-ATA4 drives require INITIALIZE DEVICE PARAMETERS command before
+ other commands (except IDENTIFY) so send SET FEATURES only if there are
+ no pending drive->special requests
+* update comments and patch description
+* any bugs introduced by this patch are mine and not Suleiman's :-)
+
+Signed-off-by: Suleiman Souhlal <suleiman@google.com>
+Acked-by: Alan Cox <alan@redhat.com>
+Cc: Chuck Ebbert <cebbert@redhat.com>
+Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
+
+---
+ drivers/ide/ide-io.c | 32 +++++++++++++++++++++-----------
+ drivers/ide/ide-iops.c | 3 +++
+ include/linux/ide.h | 1 +
+ 3 files changed, 25 insertions(+), 11 deletions(-)
+
+--- a/drivers/ide/ide-io.c
++++ b/drivers/ide/ide-io.c
+@@ -519,21 +519,24 @@ static ide_startstop_t ide_ata_error(ide
+ if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0)
+ try_to_flush_leftover_data(drive);
+
++ if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) {
++ ide_kill_rq(drive, rq);
++ return ide_stopped;
++ }
++
+ if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
+- /* force an abort */
+- hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG);
++ rq->errors |= ERROR_RESET;
+
+- if (rq->errors >= ERROR_MAX || blk_noretry_request(rq))
+- ide_kill_rq(drive, rq);
+- else {
+- if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
+- ++rq->errors;
+- return ide_do_reset(drive);
+- }
+- if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
+- drive->special.b.recalibrate = 1;
++ if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
+ ++rq->errors;
++ return ide_do_reset(drive);
+ }
++
++ if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
++ drive->special.b.recalibrate = 1;
++
++ ++rq->errors;
++
+ return ide_stopped;
+ }
+
+@@ -1025,6 +1028,13 @@ static ide_startstop_t start_request (id
+ if (!drive->special.all) {
+ ide_driver_t *drv;
+
++ /*
++ * We reset the drive so we need to issue a SETFEATURES.
++ * Do it _after_ do_special() restored device parameters.
++ */
++ if (drive->current_speed == 0xff)
++ ide_config_drive_speed(drive, drive->desired_speed);
++
+ if (rq->cmd_type == REQ_TYPE_ATA_CMD ||
+ rq->cmd_type == REQ_TYPE_ATA_TASK ||
+ rq->cmd_type == REQ_TYPE_ATA_TASKFILE)
+--- a/drivers/ide/ide-iops.c
++++ b/drivers/ide/ide-iops.c
+@@ -1123,6 +1123,9 @@ static void pre_reset(ide_drive_t *drive
+ if (HWIF(drive)->pre_reset != NULL)
+ HWIF(drive)->pre_reset(drive);
+
++ if (drive->current_speed != 0xff)
++ drive->desired_speed = drive->current_speed;
++ drive->current_speed = 0xff;
+ }
+
+ /*
+--- a/include/linux/ide.h
++++ b/include/linux/ide.h
+@@ -607,6 +607,7 @@ typedef struct ide_drive_s {
+ u8 init_speed; /* transfer rate set at boot */
+ u8 pio_speed; /* unused by core, used by some drivers for fallback from DMA */
+ u8 current_speed; /* current transfer rate set */
++ u8 desired_speed; /* desired transfer rate set */
+ u8 dn; /* now wide spread use */
+ u8 wcache; /* status of write cache */
+ u8 acoustic; /* acoustic management */
--- /dev/null
+From stable-bounces@linux.kernel.org Wed Apr 4 12:31:03 2007
+From Neil Brown <neilb@suse.de>
+Date: Wed, 04 Apr 2007 15:29:43 -0400
+Subject: knfsd: allow nfsd READDIR to return 64bit cookies
+To: linux-stable <stable@kernel.org>
+Message-ID: <4613FCA7.8080007@redhat.com>
+
+From Neil Brown <neilb@suse.de>
+
+[PATCH] knfsd: allow nfsd READDIR to return 64bit cookies
+
+->readdir passes lofft_t offsets (used as nfs cookies) to
+nfs3svc_encode_entry{,_plus}, but when they pass it on to encode_entry it
+becomes an 'off_t', which isn't good.
+
+So filesystems that returned 64bit offsets would lose.
+
+Signed-off-by: Neil Brown <neilb@suse.de>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Chuck Ebbert <cebbert@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ fs/nfsd/nfs3xdr.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/fs/nfsd/nfs3xdr.c
++++ b/fs/nfsd/nfs3xdr.c
+@@ -844,8 +844,8 @@ compose_entry_fh(struct nfsd3_readdirres
+ #define NFS3_ENTRY_BAGGAGE (2 + 1 + 2 + 1)
+ #define NFS3_ENTRYPLUS_BAGGAGE (1 + 21 + 1 + (NFS3_FHSIZE >> 2))
+ static int
+-encode_entry(struct readdir_cd *ccd, const char *name,
+- int namlen, off_t offset, ino_t ino, unsigned int d_type, int plus)
++encode_entry(struct readdir_cd *ccd, const char *name, int namlen,
++ loff_t offset, ino_t ino, unsigned int d_type, int plus)
+ {
+ struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres,
+ common);
+@@ -865,7 +865,7 @@ encode_entry(struct readdir_cd *ccd, con
+ *cd->offset1 = htonl(offset64 & 0xffffffff);
+ cd->offset1 = NULL;
+ } else {
+- xdr_encode_hyper(cd->offset, (u64) offset);
++ xdr_encode_hyper(cd->offset, offset64);
+ }
+ }
+
--- /dev/null
+From stable-bounces@linux.kernel.org Mon Apr 9 12:22:35 2007
+From: Mark Lord <mlord@pobox.com>
+Date: Mon, 09 Apr 2007 15:21:15 -0400
+Subject: [stable] libata bugfix: preserve LBA bit for HDIO_DRIVE_TASK
+To: linux-stable <stable@kernel.org>
+Message-ID: <461A922B.2020506@redhat.com>
+
+From: Mark Lord <mlord@pobox.com>
+
+libata bugfix: preserve LBA bit for HDIO_DRIVE_TASK
+
+Preserve the LBA bit in the DevSel/Head register for HDIO_DRIVE_TASK.
+
+Signed-off-by: Mark Lord <mlord@pobox.com>
+Signed-off-by: Jeff Garzik <jeff@garzik.org>
+Cc: Chuck Ebbert <cebbert@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/ata/libata-scsi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/ata/libata-scsi.c
++++ b/drivers/ata/libata-scsi.c
+@@ -295,7 +295,7 @@ int ata_task_ioctl(struct scsi_device *s
+ scsi_cmd[8] = args[3];
+ scsi_cmd[10] = args[4];
+ scsi_cmd[12] = args[5];
+- scsi_cmd[13] = args[6] & 0x0f;
++ scsi_cmd[13] = args[6] & 0x4f;
+ scsi_cmd[14] = args[0];
+
+ /* Good values for timeout and retries? Values below
--- /dev/null
+From stable-bounces@linux.kernel.org Tue Apr 10 11:10:01 2007
+From: Albert Lee <albertcc@tw.ibm.com>
+Date: Tue, 10 Apr 2007 14:07:52 -0400
+Subject: libata: Clear tf before doing request sense (take 3)
+To: linux-stable <stable@kernel.org>
+Message-ID: <461BD278.3070701@redhat.com>
+
+From: Albert Lee <albertcc@tw.ibm.com>
+
+libata: Clear tf before doing request sense (take 3)
+
+patch 2/4:
+ Clear tf before doing request sense.
+
+This fixes the AOpen 56X/AKH timeout problem.
+(http://bugzilla.kernel.org/show_bug.cgi?id=8244)
+
+Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
+Signed-off-by: Jeff Garzik <jeff@garzik.org>
+Cc: Chuck Ebbert <cebbert@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/ata/libata-eh.c | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+--- a/drivers/ata/libata-eh.c
++++ b/drivers/ata/libata-eh.c
+@@ -954,26 +954,27 @@ static int ata_eh_read_log_10h(struct at
+ * RETURNS:
+ * 0 on success, AC_ERR_* mask on failure
+ */
+-static unsigned int atapi_eh_request_sense(struct ata_device *dev,
+- unsigned char *sense_buf)
++static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc)
+ {
++ struct ata_device *dev = qc->dev;
++ unsigned char *sense_buf = qc->scsicmd->sense_buffer;
+ struct ata_port *ap = dev->ap;
+ struct ata_taskfile tf;
+ u8 cdb[ATAPI_CDB_LEN];
+
+ DPRINTK("ATAPI request sense\n");
+
+- ata_tf_init(dev, &tf);
+-
+ /* FIXME: is this needed? */
+ memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE);
+
+- /* XXX: why tf_read here? */
+- ap->ops->tf_read(ap, &tf);
+-
+- /* fill these in, for the case where they are -not- overwritten */
++ /* initialize sense_buf with the error register,
++ * for the case where they are -not- overwritten
++ */
+ sense_buf[0] = 0x70;
+- sense_buf[2] = tf.feature >> 4;
++ sense_buf[2] = qc->result_tf.feature >> 4;
++
++ /* some devices time out if garbage left in tf */
++ ata_tf_init(dev, &tf);
+
+ memset(cdb, 0, ATAPI_CDB_LEN);
+ cdb[0] = REQUEST_SENSE;
+@@ -1137,8 +1138,7 @@ static unsigned int ata_eh_analyze_tf(st
+
+ case ATA_DEV_ATAPI:
+ if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) {
+- tmp = atapi_eh_request_sense(qc->dev,
+- qc->scsicmd->sense_buffer);
++ tmp = atapi_eh_request_sense(qc);
+ if (!tmp) {
+ /* ATA_QCFLAG_SENSE_VALID is used to
+ * tell atapi_qc_complete() that sense
fix-ipsec-replay-window-handling.patch
fix-tcindex-classifier-abi-borkage.patch
fix-tcp-slow_start_after_idle-sysctl.patch
+ide-use-correct-ide-error-recovery.patch
+knfsd-allow-nfsd-readdir-to-return-64bit-cookies.patch
+softmac-avoid-assert-in-ieee80211softmac_wx_get_rate.patch
+libata-bugfix-preserve-lba-bit-for-hdio_drive_task.patch
+ahci.c-walkaround-for-sb600-sata-internal-error-issue.patch
+fix-lba48-bug-in-libata-fill_result_tf.patch
+libata-clear-tf-before-doing-request-sense.patch
--- /dev/null
+From stable-bounces@linux.kernel.org Wed Apr 4 12:31:58 2007
+From: John W. Linville <linville@tuxdriver.com>
+Date: Wed, 04 Apr 2007 15:30:35 -0400
+Subject: softmac: avoid assert in ieee80211softmac_wx_get_rate
+To: linux-stable <stable@kernel.org>
+Message-ID: <4613FCDB.3020905@redhat.com>
+
+From: John W. Linville <linville@tuxdriver.com>
+
+[PATCH] softmac: avoid assert in ieee80211softmac_wx_get_rate
+
+Unconfigured bcm43xx device can hit an assert() during wx_get_rate
+queries. This is because bcm43xx calls ieee80211softmac_start late
+(i.e. during open instead of probe).
+
+ bcm43xx_net_open ->
+ bcm43xx_init_board ->
+ bcm43xx_select_wireless_core ->
+ ieee80211softmac_start
+
+Fix is to check that device is running before completing
+ieee80211softmac_wx_get_rate.
+
+Signed-off-by: John W. Linville <linville@tuxdriver.com>
+Cc: Chuck Ebbert <cebbert@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ net/ieee80211/softmac/ieee80211softmac_wx.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/net/ieee80211/softmac/ieee80211softmac_wx.c
++++ b/net/ieee80211/softmac/ieee80211softmac_wx.c
+@@ -265,6 +265,12 @@ ieee80211softmac_wx_get_rate(struct net_
+ int err = -EINVAL;
+
+ spin_lock_irqsave(&mac->lock, flags);
++
++ if (unlikely(!mac->running)) {
++ err = -ENODEV;
++ goto out_unlock;
++ }
++
+ switch (mac->txrates.default_rate) {
+ case IEEE80211_CCK_RATE_1MB:
+ data->bitrate.value = 1000000;