2.6.x libata fixes
PATCH 1/1 2.6.x libata fixes
Please pull from 'upstream-fixes' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
to receive the following fixes:
drivers/scsi/ahci.c | 31 ++++++++++++++---- drivers/scsi/libata-core.c | 64 ++++++++++++++++--------------------- drivers/scsi/libata-scsi.c | 77 +++++++++++++++++++++++++-------------------- drivers/scsi/libata.h | 2 - include/linux/libata.h | 14 ++++++++ 5 files changed, 111 insertions(+), 77 deletions(-)
Jeff Garzik:
[libata ahci] error handling fixes
[libata] fix bugs in ATAPI padding DMA mapping code [libata] minor fixes, new helpers
[libata] REQUEST SENSE handling fixes
[libata ahci] command completion fixes, improved debug msgs
drivers/scsi/ahci.c +25 -6
@@ -565,6 +565,17 @@ static void ahci_intr_error(struct ata_pu32 tmp;int work; +printk (KERN_WARNING "ata%u: port reset, " +"p_is %x is %x pis %x cmd %x tf %x ss %x se %x\n" , + ap->id, + irq_stat, +readl (mmio +HOST_IRQ_STAT ), +readl (port_mmio +PORT_IRQ_STAT ), +readl (port_mmio +PORT_CMD ), +readl (port_mmio +PORT_TFDATA ), +readl (port_mmio +PORT_SCR_STAT ), +readl (port_mmio +PORT_SCR_ERR )); +/* stop DMA */ tmp =readl (port_mmio +PORT_CMD ); tmp &= ~PORT_CMD_START ;
@@ -602,8 +613,6 @@ static void ahci_intr_error(struct ata_p tmp |=PORT_CMD_START ;writel (tmp, port_mmio +PORT_CMD );readl (port_mmio +PORT_CMD );/* flush */ - -printk (KERN_WARNING "ata%u: error occurred, port reset\n" , ap->id); }static void ahci_eng_timeout (struct ata_port *ap)
@@ -614,17 +623,17 @@ static void ahci_eng_timeout(struct ata_struct ata_queued_cmd *qc;unsigned long flags; -DPRINTK ("ENTER\n" ); +printk (KERN_WARNING "ata%u: handling error/timeout\n" , ap->id);spin_lock_irqsave (&host_set->lock, flags); -ahci_intr_error (ap,readl (port_mmio +PORT_IRQ_STAT )); - qc =ata_qc_from_tag (ap, ap->active_tag);if (!qc) {printk (KERN_ERR "ata%u: BUG: timeout without command\n" , ap->id); }else { +ahci_intr_error (ap,readl (port_mmio +PORT_IRQ_STAT )); +/* hack alert! We cannot use the supplied completion * function from inside the ->eh_strategy_handler() thread. * libata is the only user of ->eh_strategy_handler() in
@@ -659,9 +668,19 @@ static inline int ahci_host_intr(struct }if (status &PORT_IRQ_FATAL ) { +unsigned int err_mask; +if (status &PORT_IRQ_TF_ERR ) + err_mask =AC_ERR_DEV ; +else if (status &PORT_IRQ_IF_ERR ) + err_mask =AC_ERR_ATA_BUS ; +else + err_mask =AC_ERR_HOST_BUS ; + +/* command processing has stopped due to error; restart */ ahci_intr_error (ap, status); +if (qc) -ata_qc_complete (qc,AC_ERR_OTHER ); +ata_qc_complete (qc, err_mask); }return 1 ;
drivers/scsi/libata-core.c +29 -35
151 lines not on this page · raw message
drivers/scsi/libata-scsi.c +43 -34
106 lines not on this page · raw message
drivers/scsi/libata.h +0 -2
@@ -54,8 +54,6 @@ extern int ata_cmd_ioctl(struct scsi_dev/* libata-scsi.c */ -extern void atapi_request_sense (struct ata_port *ap,struct ata_device *dev, -struct scsi_cmnd *cmd);extern void ata_scsi_scan_host (struct ata_port *ap);extern int ata_scsi_error (struct Scsi_Host *host); extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
include/linux/libata.h +14 -0
@@ -59,6 +59,8 @@ #define VPRINTK(fmt, args...)#endif /* ATA_DEBUG */ +#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) +#ifdef ATA_NDEBUG #define assert (expr)#else
@@ -119,6 +121,7 @@ enum {ATA_FLAG_PIO_DMA = (1 <<8 ),/* PIO cmds via DMA */ ATA_FLAG_NOINTR = (1 <<9 ),/* FIXME: Remove this once * proper HSM is in place. */ +ATA_FLAG_DEBUGMSG = (1 <<10 ),ATA_QCFLAG_ACTIVE = (1 <<1 ),/* cmd not yet ack'd to scsi lyer */ ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
@@ -659,6 +662,17 @@ static inline void ata_tf_init(struct at tf->device =ATA_DEVICE_OBS |ATA_DEV1 ; } +static inline void ata_qc_reinit (struct ata_queued_cmd *qc) +{ + qc->__sg =NULL ; + qc->flags =0 ; + qc->cursect = qc->cursg = qc->cursg_ofs =0 ; + qc->nsect =0 ; + qc->nbytes = qc->curbytes =0 ; + +ata_tf_init (qc->ap, &qc->tf, qc->dev->devno); +} +/** * ata_irq_on - Enable interrupts on a port.