mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brett Russ <russb@emc.com>
To: jgarzik@pobox.com
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH libata-dev-2.6 02/03] libata: create/use ata_dump_status()
Date: Wed, 23 Mar 2005 15:42:29 -0500 (EST)	[thread overview]
Message-ID: <20050323203514.D82D888C@lns1032.lss.emc.com> (raw)
In-Reply-To: <20050323203514.D62A1893@lns1032.lss.emc.com>

02_libata_ata_dump_status.patch

	This patch introduces the ata_dump_status() function, which
	for now is called from ata_to_sense_error() only.

Signed-off-by: Brett Russ <russb@emc.com>

 libata-scsi.c |   76 +++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 44 insertions(+), 32 deletions(-)

Index: libata-dev-2.6/drivers/scsi/libata-scsi.c
===================================================================
--- libata-dev-2.6.orig/drivers/scsi/libata-scsi.c	2005-03-23 15:35:09.000000000 -0500
+++ libata-dev-2.6/drivers/scsi/libata-scsi.c	2005-03-23 15:35:09.000000000 -0500
@@ -331,6 +331,49 @@ struct ata_queued_cmd *ata_scsi_qc_new(s
 }
 
 /**
+ *	ata_dump_status - user friendly display of error info
+ *	@id: id of the port in question
+ *	@tf: ptr to filled out taskfile
+ *
+ *	Decode and dump the ATA error/status registers for the user so
+ *	that they have some idea what really happened at the non
+ *	make-believe layer.
+ *
+ *	LOCKING:
+ *	inherited from caller
+ */
+void ata_dump_status(unsigned id, u8 stat, u8 err)
+{
+	printk(KERN_WARNING "ata%u: status=0x%02x { ", id, stat);
+	if (stat & ATA_BUSY) {
+		printk("Busy }\n");	/* Data is not valid in this case */
+	} else {
+		if (stat & 0x40)	printk("DriveReady ");
+		if (stat & 0x20)	printk("DeviceFault ");
+		if (stat & 0x10)	printk("SeekComplete ");
+		if (stat & 0x08)	printk("DataRequest ");
+		if (stat & 0x04)	printk("CorrectedError ");
+		if (stat & 0x02)	printk("Index ");
+		if (stat & 0x01)	printk("Error ");
+		printk("}\n");
+
+		if (err) {
+			printk(KERN_WARNING "ata%u: error=0x%02x { ", id, err);
+			if (err & 0x04)		printk("DriveStatusError ");
+			if (err & 0x80) {
+				if (err & 0x04)	printk("BadCRC ");
+				else		printk("Sector ");
+			}
+			if (err & 0x40)		printk("UncorrectableError ");
+			if (err & 0x10)		printk("SectorIdNotFound ");
+			if (err & 0x02)		printk("TrackZeroNotFound ");
+			if (err & 0x01)		printk("AddrMarkNotFound ");
+			printk("}\n");
+		}
+	}
+}
+
+/**
  *	ata_to_sense_error - convert ATA error to SCSI error
  *	@qc: Command that we are erroring out
  *	@drv_stat: value contained in ATA status register
@@ -400,38 +443,7 @@ void ata_to_sense_error(struct ata_queue
 	if (drv_stat & ATA_ERR)
 		err = ata_chk_err(qc->ap);	/* Read the err bits */
 
-	/* Display the ATA level error info */
-
-	printk(KERN_WARNING "ata%u: status=0x%02x { ", qc->ap->id, drv_stat);
-	if (drv_stat & 0x80) {
-		printk("Busy ");
-		err = 0;	/* Data is not valid in this case */
-	} else {
-		if (drv_stat & 0x40)	printk("DriveReady ");
-		if (drv_stat & 0x20)	printk("DeviceFault ");
-		if (drv_stat & 0x10)	printk("SeekComplete ");
-		if (drv_stat & 0x08)	printk("DataRequest ");
-		if (drv_stat & 0x04)	printk("CorrectedError ");
-		if (drv_stat & 0x02)	printk("Index ");
-		if (drv_stat & 0x01)	printk("Error ");
-	}
-	printk("}\n");
-
-	if (err) {
-		printk(KERN_WARNING "ata%u: error=0x%02x { ", qc->ap->id, err);
-		if (err & 0x04)		printk("DriveStatusError ");
-		if (err & 0x80) {
-			if (err & 0x04)	printk("BadCRC ");
-			else		printk("Sector ");
-		}
-		if (err & 0x40)		printk("UncorrectableError ");
-		if (err & 0x10)		printk("SectorIdNotFound ");
-		if (err & 0x02)		printk("TrackZeroNotFound ");
-		if (err & 0x01)		printk("AddrMarkNotFound ");
-		printk("}\n");
-
-		/* Should we dump sector info here too ?? */
-	}
+	ata_dump_status(qc->ap->id, drv_stat, err);
 
 	/* Look for err */
 	while (sense_table[i][0] != 0xFF) {


  parent reply	other threads:[~2005-03-23 21:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-17 22:20 [PATCH libata-dev-2.6 00/05] libata: scsi error handling improvements Brett Russ
2005-03-17 22:20 ` [PATCH libata-dev-2.6 01/05] libata: AHCI tf_read() support Brett Russ
2005-03-17 22:20 ` [PATCH libata-dev-2.6 02/05] libata: AHCI error handling fix Brett Russ
2005-03-17 22:20 ` [PATCH libata-dev-2.6 03/05] libata: update ATA PT sense desc code Brett Russ
2005-03-23  5:10   ` Jeff Garzik
2005-03-17 22:20 ` [PATCH libata-dev-2.6 04/05] libata: support descriptor sense in ctrl page Brett Russ
2005-03-23  4:24   ` Jeff Garzik
2005-03-17 22:20 ` [PATCH libata-dev-2.6 05/05] libata: rework how CCs generated Brett Russ
2005-03-23  5:12   ` Jeff Garzik
2005-03-23 20:36     ` [PATCH libata-dev-2.6 00/03] libata: scsi error handling improvements Brett Russ
2005-03-23 20:39       ` [PATCH libata-dev-2.6 01/03] libata: whitespace updates Brett Russ
2005-03-25  4:28         ` Jeff Garzik
2005-03-23 20:42       ` Brett Russ [this message]
2005-03-23 20:45       ` [PATCH libata-dev-2.6 03/03] libata: rework check condition handling Brett Russ

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050323203514.D82D888C@lns1032.lss.emc.com \
    --to=russb@emc.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®