Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15854
b: refs/heads/master
c: a22e2eb
h: refs/heads/master
v: v3
  • Loading branch information
Albert Lee authored and Jeff Garzik committed Dec 6, 2005
1 parent db19154 commit 16686a2
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 57 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c14b8331ec4843e4f2b67a4d847a0d812a50e43c
refs/heads/master: a22e2eb0710798009b8e696ae911aef745089dd6
12 changes: 8 additions & 4 deletions trunk/drivers/scsi/ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,8 @@ static void ahci_eng_timeout(struct ata_port *ap)
* not being called from the SCSI EH.
*/
qc->scsidone = scsi_finish_command;
ata_qc_complete(qc, AC_ERR_OTHER);
qc->err_mask |= AC_ERR_OTHER;
ata_qc_complete(qc);
}

spin_unlock_irqrestore(&host_set->lock, flags);
Expand All @@ -664,7 +665,8 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
ci = readl(port_mmio + PORT_CMD_ISSUE);
if (likely((ci & 0x1) == 0)) {
if (qc) {
ata_qc_complete(qc, 0);
assert(qc->err_mask == 0);
ata_qc_complete(qc);
qc = NULL;
}
}
Expand All @@ -681,8 +683,10 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
/* command processing has stopped due to error; restart */
ahci_restart_port(ap, status);

if (qc)
ata_qc_complete(qc, err_mask);
if (qc) {
qc->err_mask |= AC_ERR_OTHER;
ata_qc_complete(qc);
}
}

return 1;
Expand Down
32 changes: 19 additions & 13 deletions trunk/drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,9 +1053,9 @@ static int ata_qc_wait_err(struct ata_queued_cmd *qc,

if (wait_for_completion_timeout(wait, 30 * HZ) < 1) {
/* timeout handling */
unsigned int err_mask = ac_err_mask(ata_chk_status(qc->ap));
qc->err_mask |= ac_err_mask(ata_chk_status(qc->ap));

if (!err_mask) {
if (!qc->err_mask) {
printk(KERN_WARNING "ata%u: slow completion (cmd %x)\n",
qc->ap->id, qc->tf.command);
} else {
Expand All @@ -1064,7 +1064,7 @@ static int ata_qc_wait_err(struct ata_queued_cmd *qc,
rc = -EIO;
}

ata_qc_complete(qc, err_mask);
ata_qc_complete(qc);
}

return rc;
Expand Down Expand Up @@ -1175,6 +1175,7 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device)
qc->cursg_ofs = 0;
qc->cursect = 0;
qc->nsect = 1;
qc->err_mask = 0;
goto retry;
}
}
Expand Down Expand Up @@ -2777,15 +2778,15 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
* None. (grabs host lock)
*/

void ata_poll_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask)
void ata_poll_qc_complete(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
unsigned long flags;

spin_lock_irqsave(&ap->host_set->lock, flags);
ap->flags &= ~ATA_FLAG_NOINTR;
ata_irq_on(ap);
ata_qc_complete(qc, err_mask);
ata_qc_complete(qc);
spin_unlock_irqrestore(&ap->host_set->lock, flags);
}

Expand Down Expand Up @@ -2885,7 +2886,8 @@ static int ata_pio_complete (struct ata_port *ap)

ap->hsm_task_state = HSM_ST_IDLE;

ata_poll_qc_complete(qc, 0);
assert(qc->err_mask == 0);
ata_poll_qc_complete(qc);

/* another command may start at this point */

Expand Down Expand Up @@ -3261,7 +3263,8 @@ static void ata_pio_error(struct ata_port *ap)

ap->hsm_task_state = HSM_ST_IDLE;

ata_poll_qc_complete(qc, AC_ERR_ATA_BUS);
qc->err_mask |= AC_ERR_ATA_BUS;
ata_poll_qc_complete(qc);
}

static void ata_pio_task(void *_data)
Expand Down Expand Up @@ -3363,7 +3366,8 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc)
ap->id, qc->tf.command, drv_stat, host_stat);

/* complete taskfile transaction */
ata_qc_complete(qc, ac_err_mask(drv_stat));
qc->err_mask |= ac_err_mask(drv_stat);
ata_qc_complete(qc);
break;
}

Expand Down Expand Up @@ -3462,7 +3466,7 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
return qc;
}

int ata_qc_complete_noop(struct ata_queued_cmd *qc, unsigned int err_mask)
int ata_qc_complete_noop(struct ata_queued_cmd *qc)
{
return 0;
}
Expand Down Expand Up @@ -3521,7 +3525,7 @@ void ata_qc_free(struct ata_queued_cmd *qc)
* spin_lock_irqsave(host_set lock)
*/

void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask)
void ata_qc_complete(struct ata_queued_cmd *qc)
{
int rc;

Expand All @@ -3538,7 +3542,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask)
qc->flags &= ~ATA_QCFLAG_ACTIVE;

/* call completion callback */
rc = qc->complete_fn(qc, err_mask);
rc = qc->complete_fn(qc);

/* if callback indicates not to complete command (non-zero),
* return immediately
Expand Down Expand Up @@ -3976,7 +3980,8 @@ inline unsigned int ata_host_intr (struct ata_port *ap,
ap->ops->irq_clear(ap);

/* complete taskfile transaction */
ata_qc_complete(qc, ac_err_mask(status));
qc->err_mask |= ac_err_mask(status);
ata_qc_complete(qc);
break;

default:
Expand Down Expand Up @@ -4111,7 +4116,8 @@ static void atapi_packet_task(void *_data)
err_out_status:
status = ata_chk_status(ap);
err_out:
ata_poll_qc_complete(qc, __ac_err_mask(status));
qc->err_mask |= __ac_err_mask(status);
ata_poll_qc_complete(qc);
}


Expand Down
18 changes: 10 additions & 8 deletions trunk/drivers/scsi/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1203,12 +1203,11 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm
return 1;
}

static int ata_scsi_qc_complete(struct ata_queued_cmd *qc,
unsigned int err_mask)
static int ata_scsi_qc_complete(struct ata_queued_cmd *qc)
{
struct scsi_cmnd *cmd = qc->scsicmd;
u8 *cdb = cmd->cmnd;
int need_sense = (err_mask != 0);
int need_sense = (qc->err_mask != 0);

/* For ATA pass thru (SAT) commands, generate a sense block if
* user mandated it or if there's an error. Note that if we
Expand Down Expand Up @@ -1955,9 +1954,9 @@ void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8
done(cmd);
}

static int atapi_sense_complete(struct ata_queued_cmd *qc,unsigned int err_mask)
static int atapi_sense_complete(struct ata_queued_cmd *qc)
{
if (err_mask && ((err_mask & AC_ERR_DEV) == 0))
if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0))
/* FIXME: not quite right; we don't want the
* translation of taskfile registers into
* a sense descriptors, since that's only
Expand Down Expand Up @@ -2015,15 +2014,18 @@ static void atapi_request_sense(struct ata_queued_cmd *qc)

qc->complete_fn = atapi_sense_complete;

if (ata_qc_issue(qc))
ata_qc_complete(qc, AC_ERR_OTHER);
if (ata_qc_issue(qc)) {
qc->err_mask |= AC_ERR_OTHER;
ata_qc_complete(qc);
}

DPRINTK("EXIT\n");
}

static int atapi_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask)
static int atapi_qc_complete(struct ata_queued_cmd *qc)
{
struct scsi_cmnd *cmd = qc->scsicmd;
unsigned int err_mask = qc->err_mask;

VPRINTK("ENTER, err_mask 0x%X\n", err_mask);

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/libata.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct ata_scsi_args {

/* libata-core.c */
extern int atapi_enabled;
extern int ata_qc_complete_noop(struct ata_queued_cmd *qc, unsigned int err_mask);
extern int ata_qc_complete_noop(struct ata_queued_cmd *qc);
extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
struct ata_device *dev);
extern void ata_rwcmd_protocol(struct ata_queued_cmd *qc);
Expand Down
11 changes: 5 additions & 6 deletions trunk/drivers/scsi/pdc_adma.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,14 +464,12 @@ static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set)
continue;
qc = ata_qc_from_tag(ap, ap->active_tag);
if (qc && (!(qc->tf.ctl & ATA_NIEN))) {
unsigned int err_mask = 0;

if ((status & (aPERR | aPSD | aUIRQ)))
err_mask = AC_ERR_OTHER;
qc->err_mask |= AC_ERR_OTHER;
else if (pp->pkt[0] != cDONE)
err_mask = AC_ERR_OTHER;
qc->err_mask |= AC_ERR_OTHER;

ata_qc_complete(qc, err_mask);
ata_qc_complete(qc);
}
}
return handled;
Expand Down Expand Up @@ -501,7 +499,8 @@ static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set)

/* complete taskfile transaction */
pp->state = adma_state_idle;
ata_qc_complete(qc, ac_err_mask(status));
qc->err_mask |= ac_err_mask(status);
ata_qc_complete(qc);
handled = 1;
}
}
Expand Down
9 changes: 6 additions & 3 deletions trunk/drivers/scsi/sata_mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1242,8 +1242,10 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
VPRINTK("port %u IRQ found for qc, "
"ata_status 0x%x\n", port,ata_status);
/* mark qc status appropriately */
if (!(qc->tf.ctl & ATA_NIEN))
ata_qc_complete(qc, err_mask);
if (!(qc->tf.ctl & ATA_NIEN)) {
qc->err_mask |= err_mask;
ata_qc_complete(qc);
}
}
}
}
Expand Down Expand Up @@ -1864,7 +1866,8 @@ static void mv_eng_timeout(struct ata_port *ap)
*/
spin_lock_irqsave(&ap->host_set->lock, flags);
qc->scsidone = scsi_finish_command;
ata_qc_complete(qc, AC_ERR_OTHER);
qc->err_mask |= AC_ERR_OTHER;
ata_qc_complete(qc);
spin_unlock_irqrestore(&ap->host_set->lock, flags);
}
}
Expand Down
14 changes: 8 additions & 6 deletions trunk/drivers/scsi/sata_promise.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ static void pdc_eng_timeout(struct ata_port *ap)
case ATA_PROT_NODATA:
printk(KERN_ERR "ata%u: command timeout\n", ap->id);
drv_stat = ata_wait_idle(ap);
ata_qc_complete(qc, __ac_err_mask(drv_stat));
qc->err_mask |= __ac_err_mask(drv_stat);
ata_qc_complete(qc);
break;

default:
Expand All @@ -410,7 +411,8 @@ static void pdc_eng_timeout(struct ata_port *ap)
printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n",
ap->id, qc->tf.command, drv_stat);

ata_qc_complete(qc, ac_err_mask(drv_stat));
qc->err_mask |= ac_err_mask(drv_stat);
ata_qc_complete(qc);
break;
}

Expand All @@ -422,21 +424,21 @@ static void pdc_eng_timeout(struct ata_port *ap)
static inline unsigned int pdc_host_intr( struct ata_port *ap,
struct ata_queued_cmd *qc)
{
unsigned int handled = 0, err_mask = 0;
unsigned int handled = 0;
u32 tmp;
void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL;

tmp = readl(mmio);
if (tmp & PDC_ERR_MASK) {
err_mask = AC_ERR_DEV;
qc->err_mask |= AC_ERR_DEV;
pdc_reset_port(ap);
}

switch (qc->tf.protocol) {
case ATA_PROT_DMA:
case ATA_PROT_NODATA:
err_mask |= ac_err_mask(ata_wait_idle(ap));
ata_qc_complete(qc, err_mask);
qc->err_mask |= ac_err_mask(ata_wait_idle(ap));
ata_qc_complete(qc);
handled = 1;
break;

Expand Down
7 changes: 4 additions & 3 deletions trunk/drivers/scsi/sata_qstor.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ static inline unsigned int qs_intr_pkt(struct ata_host_set *host_set)
case 3: /* device error */
pp->state = qs_state_idle;
qs_enter_reg_mode(qc->ap);
ata_qc_complete(qc,
ac_err_mask(sDST));
qc->err_mask |= ac_err_mask(sDST);
ata_qc_complete(qc);
break;
default:
break;
Expand Down Expand Up @@ -447,7 +447,8 @@ static inline unsigned int qs_intr_mmio(struct ata_host_set *host_set)

/* complete taskfile transaction */
pp->state = qs_state_idle;
ata_qc_complete(qc, ac_err_mask(status));
qc->err_mask |= ac_err_mask(status);
ata_qc_complete(qc);
handled = 1;
}
}
Expand Down
15 changes: 10 additions & 5 deletions trunk/drivers/scsi/sata_sil24.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,8 @@ static void sil24_eng_timeout(struct ata_port *ap)
*/
printk(KERN_ERR "ata%u: command timeout\n", ap->id);
qc->scsidone = scsi_finish_command;
ata_qc_complete(qc, AC_ERR_OTHER);
qc->err_mask |= AC_ERR_OTHER;
ata_qc_complete(qc);

sil24_reset_controller(ap);
}
Expand Down Expand Up @@ -711,8 +712,10 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat)
sil24_reset_controller(ap);
}

if (qc)
ata_qc_complete(qc, err_mask);
if (qc) {
qc->err_mask |= err_mask;
ata_qc_complete(qc);
}
}

static inline void sil24_host_intr(struct ata_port *ap)
Expand All @@ -734,8 +737,10 @@ static inline void sil24_host_intr(struct ata_port *ap)
*/
sil24_update_tf(ap);

if (qc)
ata_qc_complete(qc, ac_err_mask(pp->tf.command));
if (qc) {
qc->err_mask |= ac_err_mask(pp->tf.command);
ata_qc_complete(qc);
}
} else
sil24_error_intr(ap, slot_stat);
}
Expand Down
Loading

0 comments on commit 16686a2

Please sign in to comment.