From nobody Sun Jun 28 04:42:56 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38013C433EF for ; Mon, 14 Feb 2022 20:46:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229941AbiBNUrA (ORCPT ); Mon, 14 Feb 2022 15:47:00 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:33482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbiBNUqB (ORCPT ); Mon, 14 Feb 2022 15:46:01 -0500 Received: from mxout03.lancloud.ru (mxout03.lancloud.ru [45.84.86.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A44FB7F4; Mon, 14 Feb 2022 12:44:17 -0800 (PST) Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout03.lancloud.ru 085F02075200 Received: from LanCloud Received: from LanCloud Received: from LanCloud From: Sergey Shtylyov Subject: [PATCH] ata: add/use ata_taskfile::{error|status} fields To: Damien Le Moal , , Organization: Open Mobile Platform Message-ID: Date: Mon, 14 Feb 2022 23:43:50 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the explicit error and status register fields to 'struct ata_taskfile' using the anonymous *union*s ('struct ide_taskfile' had that for ages!) and update the libata taskfile code accordingly. There should be no object code changes resulting from that... Signed-off-by: Sergey Shtylyov Reported-by: kernel test robot --- This patch is against the 'for-next' branch of Damien Le Moal's 'libata.git' repo plus just posted 'drivers/ata/libata-scsi.c' patch. drivers/ata/acard-ahci.c | 2 +- drivers/ata/ahci.c | 4 ++-- drivers/ata/ahci_qoriq.c | 2 +- drivers/ata/ahci_xgene.c | 2 +- drivers/ata/libahci.c | 4 ++-- drivers/ata/libata-acpi.c | 8 ++++---- drivers/ata/libata-core.c | 12 ++++++------ drivers/ata/libata-eh.c | 42 +++++++++++++++++++++----------------= ----- drivers/ata/libata-sata.c | 10 +++++----- drivers/ata/libata-scsi.c | 22 +++++++++++----------- drivers/ata/libata-sff.c | 6 +++--- drivers/ata/pata_ep93xx.c | 4 ++-- drivers/ata/pata_ns87415.c | 4 ++-- drivers/ata/pata_octeon_cf.c | 4 ++-- drivers/ata/pata_samsung_cf.c | 2 +- drivers/ata/sata_highbank.c | 2 +- drivers/ata/sata_inic162x.c | 10 +++++----- drivers/ata/sata_rcar.c | 4 ++-- drivers/ata/sata_svw.c | 10 +++++----- drivers/ata/sata_vsc.c | 8 ++++---- include/linux/libata.h | 10 ++++++++-- 21 files changed, 89 insertions(+), 83 deletions(-) Index: libata/drivers/ata/acard-ahci.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/acard-ahci.c +++ libata/drivers/ata/acard-ahci.c @@ -265,7 +265,7 @@ static bool acard_ahci_qc_fill_rtf(struc if (qc->tf.protocol =3D=3D ATA_PROT_PIO && qc->dma_dir =3D=3D DMA_FROM_DE= VICE && !(qc->flags & ATA_QCFLAG_FAILED)) { ata_tf_from_fis(rx_fis + RX_FIS_PIO_SETUP, &qc->result_tf); - qc->result_tf.command =3D (rx_fis + RX_FIS_PIO_SETUP)[15]; + qc->result_tf.status =3D (rx_fis + RX_FIS_PIO_SETUP)[15]; } else ata_tf_from_fis(rx_fis + RX_FIS_D2H_REG, &qc->result_tf); =20 Index: libata/drivers/ata/ahci.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/ahci.c +++ libata/drivers/ata/ahci.c @@ -739,7 +739,7 @@ static int ahci_p5wdh_hardreset(struct a =20 /* clear D2H reception area to properly wait for D2H FIS */ ata_tf_init(link->device, &tf); - tf.command =3D ATA_BUSY; + tf.status =3D ATA_BUSY; ata_tf_to_fis(&tf, 0, 0, d2h_fis); =20 rc =3D sata_link_hardreset(link, sata_ehc_deb_timing(&link->eh_context), @@ -808,7 +808,7 @@ static int ahci_avn_hardreset(struct ata =20 /* clear D2H reception area to properly wait for D2H FIS */ ata_tf_init(link->device, &tf); - tf.command =3D ATA_BUSY; + tf.status =3D ATA_BUSY; ata_tf_to_fis(&tf, 0, 0, d2h_fis); =20 rc =3D sata_link_hardreset(link, timing, deadline, &online, Index: libata/drivers/ata/ahci_qoriq.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/ahci_qoriq.c +++ libata/drivers/ata/ahci_qoriq.c @@ -123,7 +123,7 @@ static int ahci_qoriq_hardreset(struct a =20 /* clear D2H reception area to properly wait for D2H FIS */ ata_tf_init(link->device, &tf); - tf.command =3D ATA_BUSY; + tf.status =3D ATA_BUSY; ata_tf_to_fis(&tf, 0, 0, d2h_fis); =20 rc =3D sata_link_hardreset(link, timing, deadline, &online, Index: libata/drivers/ata/ahci_xgene.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/ahci_xgene.c +++ libata/drivers/ata/ahci_xgene.c @@ -365,7 +365,7 @@ static int xgene_ahci_do_hardreset(struc do { /* clear D2H reception area to properly wait for D2H FIS */ ata_tf_init(link->device, &tf); - tf.command =3D ATA_BUSY; + tf.status =3D ATA_BUSY; ata_tf_to_fis(&tf, 0, 0, d2h_fis); rc =3D sata_link_hardreset(link, timing, deadline, online, ahci_check_ready); Index: libata/drivers/ata/libahci.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/libahci.c +++ libata/drivers/ata/libahci.c @@ -1561,7 +1561,7 @@ int ahci_do_hardreset(struct ata_link *l =20 /* clear D2H reception area to properly wait for D2H FIS */ ata_tf_init(link->device, &tf); - tf.command =3D ATA_BUSY; + tf.status =3D ATA_BUSY; ata_tf_to_fis(&tf, 0, 0, d2h_fis); =20 rc =3D sata_link_hardreset(link, timing, deadline, online, @@ -2033,7 +2033,7 @@ static bool ahci_qc_fill_rtf(struct ata_ if (qc->tf.protocol =3D=3D ATA_PROT_PIO && qc->dma_dir =3D=3D DMA_FROM_DE= VICE && !(qc->flags & ATA_QCFLAG_FAILED)) { ata_tf_from_fis(rx_fis + RX_FIS_PIO_SETUP, &qc->result_tf); - qc->result_tf.command =3D (rx_fis + RX_FIS_PIO_SETUP)[15]; + qc->result_tf.status =3D (rx_fis + RX_FIS_PIO_SETUP)[15]; } else ata_tf_from_fis(rx_fis + RX_FIS_D2H_REG, &qc->result_tf); =20 Index: libata/drivers/ata/libata-acpi.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/libata-acpi.c +++ libata/drivers/ata/libata-acpi.c @@ -546,13 +546,13 @@ static void ata_acpi_gtf_to_tf(struct at =20 tf->flags |=3D ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; tf->protocol =3D ATA_PROT_NODATA; - tf->feature =3D gtf->tf[0]; /* 0x1f1 */ + tf->error =3D gtf->tf[0]; /* 0x1f1 */ tf->nsect =3D gtf->tf[1]; /* 0x1f2 */ tf->lbal =3D gtf->tf[2]; /* 0x1f3 */ tf->lbam =3D gtf->tf[3]; /* 0x1f4 */ tf->lbah =3D gtf->tf[4]; /* 0x1f5 */ tf->device =3D gtf->tf[5]; /* 0x1f6 */ - tf->command =3D gtf->tf[6]; /* 0x1f7 */ + tf->status =3D gtf->tf[6]; /* 0x1f7 */ } =20 static int ata_acpi_filter_tf(struct ata_device *dev, @@ -679,7 +679,7 @@ static int ata_acpi_run_tf(struct ata_de "(%s) rejected by device (Stat=3D0x%02x Err=3D0x%02x)", tf.command, tf.feature, tf.nsect, tf.lbal, tf.lbam, tf.lbah, tf.device, descr, - rtf.command, rtf.feature); + rtf.status, rtf.error); rc =3D 0; break; =20 @@ -689,7 +689,7 @@ static int ata_acpi_run_tf(struct ata_de "(%s) failed (Emask=3D0x%x Stat=3D0x%02x Err=3D0x%02x)", tf.command, tf.feature, tf.nsect, tf.lbal, tf.lbam, tf.lbah, tf.device, descr, - err_mask, rtf.command, rtf.feature); + err_mask, rtf.status, rtf.error); rc =3D -EIO; break; } Index: libata/drivers/ata/libata-core.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/libata-core.c +++ libata/drivers/ata/libata-core.c @@ -1171,7 +1171,7 @@ static int ata_read_native_max_address(s ata_dev_warn(dev, "failed to read native max address (err_mask=3D0x%x)\n", err_mask); - if (err_mask =3D=3D AC_ERR_DEV && (tf.feature & ATA_ABORTED)) + if (err_mask =3D=3D AC_ERR_DEV && (tf.error & ATA_ABORTED)) return -EACCES; return -EIO; } @@ -1235,7 +1235,7 @@ static int ata_set_max_sectors(struct at "failed to set max address (err_mask=3D0x%x)\n", err_mask); if (err_mask =3D=3D AC_ERR_DEV && - (tf.feature & (ATA_ABORTED | ATA_IDNF))) + (tf.error & (ATA_ABORTED | ATA_IDNF))) return -EACCES; return -EIO; } @@ -1584,7 +1584,7 @@ unsigned ata_exec_internal_sg(struct ata =20 /* perform minimal error analysis */ if (qc->flags & ATA_QCFLAG_FAILED) { - if (qc->result_tf.command & (ATA_ERR | ATA_DF)) + if (qc->result_tf.status & (ATA_ERR | ATA_DF)) qc->err_mask |=3D AC_ERR_DEV; =20 if (!qc->err_mask) @@ -1593,7 +1593,7 @@ unsigned ata_exec_internal_sg(struct ata if (qc->err_mask & ~AC_ERR_OTHER) qc->err_mask &=3D ~AC_ERR_OTHER; } else if (qc->tf.command =3D=3D ATA_CMD_REQ_SENSE_DATA) { - qc->result_tf.command |=3D ATA_SENSE; + qc->result_tf.status |=3D ATA_SENSE; } =20 /* finish up */ @@ -1813,7 +1813,7 @@ retry: return 0; } =20 - if ((err_mask =3D=3D AC_ERR_DEV) && (tf.feature & ATA_ABORTED)) { + if ((err_mask =3D=3D AC_ERR_DEV) && (tf.error & ATA_ABORTED)) { /* Device or controller might have reported * the wrong device class. Give a shot at the * other IDENTIFY if the current one is @@ -4375,7 +4375,7 @@ static unsigned int ata_dev_init_params( /* A clean abort indicates an original or just out of spec drive and we should continue as we issue the setup based on the drive reported working geometry */ - if (err_mask =3D=3D AC_ERR_DEV && (tf.feature & ATA_ABORTED)) + if (err_mask =3D=3D AC_ERR_DEV && (tf.error & ATA_ABORTED)) err_mask =3D 0; =20 return err_mask; Index: libata/drivers/ata/libata-eh.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/libata-eh.c +++ libata/drivers/ata/libata-eh.c @@ -1386,7 +1386,7 @@ unsigned int atapi_eh_tur(struct ata_dev =20 err_mask =3D ata_exec_internal(dev, &tf, cdb, DMA_NONE, NULL, 0, 0); if (err_mask =3D=3D AC_ERR_DEV) - *r_sense_key =3D tf.feature >> 4; + *r_sense_key =3D tf.error >> 4; return err_mask; } =20 @@ -1429,12 +1429,12 @@ static void ata_eh_request_sense(struct =20 err_mask =3D ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); /* Ignore err_mask; ATA_ERR might be set */ - if (tf.command & ATA_SENSE) { + if (tf.status & ATA_SENSE) { ata_scsi_set_sense(dev, cmd, tf.lbah, tf.lbam, tf.lbal); qc->flags |=3D ATA_QCFLAG_SENSE_VALID; } else { ata_dev_warn(dev, "request sense failed stat %02x emask %x\n", - tf.command, err_mask); + tf.status, err_mask); } } =20 @@ -1557,7 +1557,7 @@ static unsigned int ata_eh_analyze_tf(st const struct ata_taskfile *tf) { unsigned int tmp, action =3D 0; - u8 stat =3D tf->command, err =3D tf->feature; + u8 stat =3D tf->status, err =3D tf->error; =20 if ((stat & (ATA_BUSY | ATA_DRQ | ATA_DRDY)) !=3D ATA_DRDY) { qc->err_mask |=3D AC_ERR_HSM; @@ -1594,7 +1594,7 @@ static unsigned int ata_eh_analyze_tf(st if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { tmp =3D atapi_eh_request_sense(qc->dev, qc->scsicmd->sense_buffer, - qc->result_tf.feature >> 4); + qc->result_tf.error >> 4); if (!tmp) qc->flags |=3D ATA_QCFLAG_SENSE_VALID; else @@ -2360,7 +2360,7 @@ static void ata_eh_link_report(struct at cmd->hob_feature, cmd->hob_nsect, cmd->hob_lbal, cmd->hob_lbam, cmd->hob_lbah, cmd->device, qc->tag, data_buf, cdb_buf, - res->command, res->feature, res->nsect, + res->status, res->error, res->nsect, res->lbal, res->lbam, res->lbah, res->hob_feature, res->hob_nsect, res->hob_lbal, res->hob_lbam, res->hob_lbah, @@ -2368,28 +2368,28 @@ static void ata_eh_link_report(struct at qc->err_mask & AC_ERR_NCQ ? " " : ""); =20 #ifdef CONFIG_ATA_VERBOSE_ERROR - if (res->command & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | - ATA_SENSE | ATA_ERR)) { - if (res->command & ATA_BUSY) + if (res->status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | + ATA_SENSE | ATA_ERR)) { + if (res->status & ATA_BUSY) ata_dev_err(qc->dev, "status: { Busy }\n"); else ata_dev_err(qc->dev, "status: { %s%s%s%s%s}\n", - res->command & ATA_DRDY ? "DRDY " : "", - res->command & ATA_DF ? "DF " : "", - res->command & ATA_DRQ ? "DRQ " : "", - res->command & ATA_SENSE ? "SENSE " : "", - res->command & ATA_ERR ? "ERR " : ""); + res->status & ATA_DRDY ? "DRDY " : "", + res->status & ATA_DF ? "DF " : "", + res->status & ATA_DRQ ? "DRQ " : "", + res->status & ATA_SENSE ? "SENSE " : "", + res->status & ATA_ERR ? "ERR " : ""); } =20 if (cmd->command !=3D ATA_CMD_PACKET && - (res->feature & (ATA_ICRC | ATA_UNC | ATA_AMNF | - ATA_IDNF | ATA_ABORTED))) + (res->error & (ATA_ICRC | ATA_UNC | ATA_AMNF | ATA_IDNF | + ATA_ABORTED))) ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n", - res->feature & ATA_ICRC ? "ICRC " : "", - res->feature & ATA_UNC ? "UNC " : "", - res->feature & ATA_AMNF ? "AMNF " : "", - res->feature & ATA_IDNF ? "IDNF " : "", - res->feature & ATA_ABORTED ? "ABRT " : ""); + res->error & ATA_ICRC ? "ICRC " : "", + res->error & ATA_UNC ? "UNC " : "", + res->error & ATA_AMNF ? "AMNF " : "", + res->error & ATA_IDNF ? "IDNF " : "", + res->error & ATA_ABORTED ? "ABRT " : ""); #endif } } Index: libata/drivers/ata/libata-sata.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/libata-sata.c +++ libata/drivers/ata/libata-sata.c @@ -191,8 +191,8 @@ EXPORT_SYMBOL_GPL(ata_tf_to_fis); =20 void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf) { - tf->command =3D fis[2]; /* status */ - tf->feature =3D fis[3]; /* error */ + tf->status =3D fis[2]; + tf->error =3D fis[3]; =20 tf->lbal =3D fis[4]; tf->lbam =3D fis[5]; @@ -1406,8 +1406,8 @@ static int ata_eh_read_log_10h(struct at =20 *tag =3D buf[0] & 0x1f; =20 - tf->command =3D buf[2]; - tf->feature =3D buf[3]; + tf->status =3D buf[2]; + tf->error =3D buf[3]; tf->lbal =3D buf[4]; tf->lbam =3D buf[5]; tf->lbah =3D buf[6]; @@ -1482,7 +1482,7 @@ void ata_eh_analyze_ncq_error(struct ata qc->result_tf.flags =3D ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA4= 8; qc->err_mask |=3D AC_ERR_DEV | AC_ERR_NCQ; if (dev->class =3D=3D ATA_DEV_ZAC && - ((qc->result_tf.command & ATA_SENSE) || qc->result_tf.auxiliary)) { + ((qc->result_tf.status & ATA_SENSE) || qc->result_tf.auxiliary)) { char sense_key, asc, ascq; =20 sense_key =3D (qc->result_tf.auxiliary >> 16) & 0xff; Index: libata/drivers/ata/libata-scsi.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/libata-scsi.c +++ libata/drivers/ata/libata-scsi.c @@ -680,7 +680,7 @@ static void ata_qc_set_pc_nbytes(struct */ static void ata_dump_status(struct ata_port *ap, struct ata_taskfile *tf) { - u8 stat =3D tf->command, err =3D tf->feature; + u8 stat =3D tf->status, err =3D tf->error; =20 if (stat & ATA_BUSY) { ata_port_warn(ap, "status=3D0x%02x {Busy} ", stat); @@ -871,8 +871,8 @@ static void ata_gen_passthru_sense(struc * onto sense key, asc & ascq. */ if (qc->err_mask || - tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { - ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature, + tf->status & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { + ata_to_sense_error(qc->ap->print_id, tf->status, tf->error, &sense_key, &asc, &ascq, verbose); ata_scsi_set_sense(qc->dev, cmd, sense_key, asc, ascq); } else { @@ -901,13 +901,13 @@ static void ata_gen_passthru_sense(struc * Copy registers into sense buffer. */ desc[2] =3D 0x00; - desc[3] =3D tf->feature; /* =3D=3D error reg */ + desc[3] =3D tf->error; desc[5] =3D tf->nsect; desc[7] =3D tf->lbal; desc[9] =3D tf->lbam; desc[11] =3D tf->lbah; desc[12] =3D tf->device; - desc[13] =3D tf->command; /* =3D=3D status reg */ + desc[13] =3D tf->status; =20 /* * Fill in Extend bit, and the high order bytes @@ -922,8 +922,8 @@ static void ata_gen_passthru_sense(struc } } else { /* Fixed sense format */ - desc[0] =3D tf->feature; - desc[1] =3D tf->command; /* status */ + desc[0] =3D tf->error; + desc[1] =3D tf->status; desc[2] =3D tf->device; desc[3] =3D tf->nsect; desc[7] =3D 0; @@ -972,14 +972,14 @@ static void ata_gen_ata_sense(struct ata * onto sense key, asc & ascq. */ if (qc->err_mask || - tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { - ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature, + tf->status & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { + ata_to_sense_error(qc->ap->print_id, tf->status, tf->error, &sense_key, &asc, &ascq, verbose); ata_scsi_set_sense(dev, cmd, sense_key, asc, ascq); } else { /* Could not decode error */ ata_dev_warn(dev, "could not decode error status 0x%x err_mask 0x%x\n", - tf->command, qc->err_mask); + tf->status, qc->err_mask); ata_scsi_set_sense(dev, cmd, ABORTED_COMMAND, 0, 0); return; } @@ -2473,7 +2473,7 @@ static void atapi_request_sense(struct a =20 /* fill these in, for the case where they are -not- overwritten */ cmd->sense_buffer[0] =3D 0x70; - cmd->sense_buffer[2] =3D qc->tf.feature >> 4; + cmd->sense_buffer[2] =3D qc->tf.error >> 4; =20 ata_qc_reinit(qc); =20 Index: libata/drivers/ata/libata-sff.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/libata-sff.c +++ libata/drivers/ata/libata-sff.c @@ -449,8 +449,8 @@ void ata_sff_tf_read(struct ata_port *ap { struct ata_ioports *ioaddr =3D &ap->ioaddr; =20 - tf->command =3D ata_sff_check_status(ap); - tf->feature =3D ioread8(ioaddr->error_addr); + tf->status =3D ata_sff_check_status(ap); + tf->error =3D ioread8(ioaddr->error_addr); tf->nsect =3D ioread8(ioaddr->nsect_addr); tf->lbal =3D ioread8(ioaddr->lbal_addr); tf->lbam =3D ioread8(ioaddr->lbam_addr); @@ -1824,7 +1824,7 @@ unsigned int ata_sff_dev_classify(struct memset(&tf, 0, sizeof(tf)); =20 ap->ops->sff_tf_read(ap, &tf); - err =3D tf.feature; + err =3D tf.error; if (r_err) *r_err =3D err; =20 Index: libata/drivers/ata/pata_ep93xx.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/pata_ep93xx.c +++ libata/drivers/ata/pata_ep93xx.c @@ -416,8 +416,8 @@ static void ep93xx_pata_tf_read(struct a { struct ep93xx_pata_data *drv_data =3D ap->host->private_data; =20 - tf->command =3D ep93xx_pata_check_status(ap); - tf->feature =3D ep93xx_pata_read_reg(drv_data, IDECTRL_ADDR_FEATURE); + tf->status =3D ep93xx_pata_check_status(ap); + tf->error =3D ep93xx_pata_read_reg(drv_data, IDECTRL_ADDR_FEATURE); tf->nsect =3D ep93xx_pata_read_reg(drv_data, IDECTRL_ADDR_NSECT); tf->lbal =3D ep93xx_pata_read_reg(drv_data, IDECTRL_ADDR_LBAL); tf->lbam =3D ep93xx_pata_read_reg(drv_data, IDECTRL_ADDR_LBAM); Index: libata/drivers/ata/pata_ns87415.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/pata_ns87415.c +++ libata/drivers/ata/pata_ns87415.c @@ -264,8 +264,8 @@ void ns87560_tf_read(struct ata_port *ap { struct ata_ioports *ioaddr =3D &ap->ioaddr; =20 - tf->command =3D ns87560_check_status(ap); - tf->feature =3D ioread8(ioaddr->error_addr); + tf->status =3D ns87560_check_status(ap); + tf->error =3D ioread8(ioaddr->error_addr); tf->nsect =3D ioread8(ioaddr->nsect_addr); tf->lbal =3D ioread8(ioaddr->lbal_addr); tf->lbam =3D ioread8(ioaddr->lbam_addr); Index: libata/drivers/ata/pata_octeon_cf.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/pata_octeon_cf.c +++ libata/drivers/ata/pata_octeon_cf.c @@ -382,7 +382,7 @@ static void octeon_cf_tf_read16(struct a void __iomem *base =3D ap->ioaddr.data_addr; =20 blob =3D __raw_readw(base + 0xc); - tf->feature =3D blob >> 8; + tf->error =3D blob >> 8; =20 blob =3D __raw_readw(base + 2); tf->nsect =3D blob & 0xff; @@ -394,7 +394,7 @@ static void octeon_cf_tf_read16(struct a =20 blob =3D __raw_readw(base + 6); tf->device =3D blob & 0xff; - tf->command =3D blob >> 8; + tf->status =3D blob >> 8; =20 if (tf->flags & ATA_TFLAG_LBA48) { if (likely(ap->ioaddr.ctl_addr)) { Index: libata/drivers/ata/pata_samsung_cf.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/pata_samsung_cf.c +++ libata/drivers/ata/pata_samsung_cf.c @@ -213,7 +213,7 @@ static void pata_s3c_tf_read(struct ata_ { struct ata_ioports *ioaddr =3D &ap->ioaddr; =20 - tf->feature =3D ata_inb(ap->host, ioaddr->error_addr); + tf->error =3D ata_inb(ap->host, ioaddr->error_addr); tf->nsect =3D ata_inb(ap->host, ioaddr->nsect_addr); tf->lbal =3D ata_inb(ap->host, ioaddr->lbal_addr); tf->lbam =3D ata_inb(ap->host, ioaddr->lbam_addr); Index: libata/drivers/ata/sata_highbank.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/sata_highbank.c +++ libata/drivers/ata/sata_highbank.c @@ -400,7 +400,7 @@ static int ahci_highbank_hardreset(struc =20 /* clear D2H reception area to properly wait for D2H FIS */ ata_tf_init(link->device, &tf); - tf.command =3D ATA_BUSY; + tf.status =3D ATA_BUSY; ata_tf_to_fis(&tf, 0, 0, d2h_fis); =20 do { Index: libata/drivers/ata/sata_inic162x.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/sata_inic162x.c +++ libata/drivers/ata/sata_inic162x.c @@ -557,13 +557,13 @@ static void inic_tf_read(struct ata_port { void __iomem *port_base =3D inic_port_base(ap); =20 - tf->feature =3D readb(port_base + PORT_TF_FEATURE); + tf->error =3D readb(port_base + PORT_TF_FEATURE); tf->nsect =3D readb(port_base + PORT_TF_NSECT); tf->lbal =3D readb(port_base + PORT_TF_LBAL); tf->lbam =3D readb(port_base + PORT_TF_LBAM); tf->lbah =3D readb(port_base + PORT_TF_LBAH); tf->device =3D readb(port_base + PORT_TF_DEVICE); - tf->command =3D readb(port_base + PORT_TF_COMMAND); + tf->status =3D readb(port_base + PORT_TF_COMMAND); } =20 static bool inic_qc_fill_rtf(struct ata_queued_cmd *qc) @@ -580,11 +580,11 @@ static bool inic_qc_fill_rtf(struct ata_ */ inic_tf_read(qc->ap, &tf); =20 - if (!(tf.command & ATA_ERR)) + if (!(tf.status & ATA_ERR)) return false; =20 - rtf->command =3D tf.command; - rtf->feature =3D tf.feature; + rtf->status =3D tf.status; + rtf->error =3D tf.error; return true; } =20 Index: libata/drivers/ata/sata_rcar.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/sata_rcar.c +++ libata/drivers/ata/sata_rcar.c @@ -394,8 +394,8 @@ static void sata_rcar_tf_read(struct ata { struct ata_ioports *ioaddr =3D &ap->ioaddr; =20 - tf->command =3D sata_rcar_check_status(ap); - tf->feature =3D ioread32(ioaddr->error_addr); + tf->status =3D sata_rcar_check_status(ap); + tf->error =3D ioread32(ioaddr->error_addr); tf->nsect =3D ioread32(ioaddr->nsect_addr); tf->lbal =3D ioread32(ioaddr->lbal_addr); tf->lbam =3D ioread32(ioaddr->lbam_addr); Index: libata/drivers/ata/sata_svw.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/sata_svw.c +++ libata/drivers/ata/sata_svw.c @@ -194,24 +194,24 @@ static void k2_sata_tf_load(struct ata_p static void k2_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) { struct ata_ioports *ioaddr =3D &ap->ioaddr; - u16 nsect, lbal, lbam, lbah, feature; + u16 nsect, lbal, lbam, lbah, error; =20 - tf->command =3D k2_stat_check_status(ap); + tf->status =3D k2_stat_check_status(ap); tf->device =3D readw(ioaddr->device_addr); - feature =3D readw(ioaddr->error_addr); + error =3D readw(ioaddr->error_addr); nsect =3D readw(ioaddr->nsect_addr); lbal =3D readw(ioaddr->lbal_addr); lbam =3D readw(ioaddr->lbam_addr); lbah =3D readw(ioaddr->lbah_addr); =20 - tf->feature =3D feature; + tf->error =3D error; tf->nsect =3D nsect; tf->lbal =3D lbal; tf->lbam =3D lbam; tf->lbah =3D lbah; =20 if (tf->flags & ATA_TFLAG_LBA48) { - tf->hob_feature =3D feature >> 8; + tf->hob_feature =3D error >> 8; tf->hob_nsect =3D nsect >> 8; tf->hob_lbal =3D lbal >> 8; tf->hob_lbam =3D lbam >> 8; Index: libata/drivers/ata/sata_vsc.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/drivers/ata/sata_vsc.c +++ libata/drivers/ata/sata_vsc.c @@ -183,17 +183,17 @@ static void vsc_sata_tf_load(struct ata_ static void vsc_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) { struct ata_ioports *ioaddr =3D &ap->ioaddr; - u16 nsect, lbal, lbam, lbah, feature; + u16 nsect, lbal, lbam, lbah, error; =20 - tf->command =3D ata_sff_check_status(ap); + tf->status =3D ata_sff_check_status(ap); tf->device =3D readw(ioaddr->device_addr); - feature =3D readw(ioaddr->error_addr); + error =3D readw(ioaddr->error_addr); nsect =3D readw(ioaddr->nsect_addr); lbal =3D readw(ioaddr->lbal_addr); lbam =3D readw(ioaddr->lbam_addr); lbah =3D readw(ioaddr->lbah_addr); =20 - tf->feature =3D feature; + tf->error =3D error; tf->nsect =3D nsect; tf->lbal =3D lbal; tf->lbam =3D lbam; Index: libata/include/linux/libata.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libata.orig/include/linux/libata.h +++ libata/include/linux/libata.h @@ -518,7 +518,10 @@ struct ata_taskfile { u8 hob_lbam; u8 hob_lbah; =20 - u8 feature; + union { + u8 error; + u8 feature; + }; u8 nsect; u8 lbal; u8 lbam; @@ -526,7 +529,10 @@ struct ata_taskfile { =20 u8 device; =20 - u8 command; /* IO operation */ + union { + u8 status; + u8 command; + }; =20 u32 auxiliary; /* auxiliary field */ /* from SATA 3.1 and */