Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93590859 authored by Alan Cox's avatar Alan Cox Committed by Jeff Garzik
Browse files

[PATCH] libata: improve handling of diagostic fail (and hardware that misreports it)



Our ATA probe code checks that a device is not reporting a diagnostic
failure during start up. Unfortunately at least one device seems to like
doing this - the Gigabyte iRAM.

This is only done for the master right now (which is fine for the iRAM
as it is SATA), as with PATA some combinations of ATAPI device seem to
fool the check into seeing a drive that isn't there if it is applied to
the slave.

Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 4a3381fe
Loading
Loading
Loading
Loading
+17 −2
Original line number Original line Diff line number Diff line
@@ -616,8 +616,11 @@ ata_dev_try_classify(struct ata_port *ap, unsigned int device, u8 *r_err)
	if (r_err)
	if (r_err)
		*r_err = err;
		*r_err = err;


	/* see if device passed diags */
	/* see if device passed diags: if master then continue and warn later */
	if (err == 1)
	if (err == 0 && device == 0)
		/* diagnostic fail : do nothing _YET_ */
		ap->device[device].horkage |= ATA_HORKAGE_DIAGNOSTIC;
	else if (err == 1)
		/* do nothing */ ;
		/* do nothing */ ;
	else if ((device == 0) && (err == 0x81))
	else if ((device == 0) && (err == 0x81))
		/* do nothing */ ;
		/* do nothing */ ;
@@ -1523,6 +1526,18 @@ int ata_dev_configure(struct ata_device *dev, int print_info)
				       cdb_intr_string);
				       cdb_intr_string);
	}
	}


	if (dev->horkage & ATA_HORKAGE_DIAGNOSTIC) {
		/* Let the user know. We don't want to disallow opens for
		   rescue purposes, or in case the vendor is just a blithering
		   idiot */
                if (print_info) {
			ata_dev_printk(dev, KERN_WARNING,
"Drive reports diagnostics failure. This may indicate a drive\n");
			ata_dev_printk(dev, KERN_WARNING,
"fault or invalid emulation. Contact drive vendor for information.\n");
		}
	}

	ata_set_port_max_cmd_len(ap);
	ata_set_port_max_cmd_len(ap);


	/* limit bridge transfers to udma5, 200 sectors */
	/* limit bridge transfers to udma5, 200 sectors */
+6 −0
Original line number Original line Diff line number Diff line
@@ -289,6 +289,11 @@ enum {
	 * most devices.
	 * most devices.
	 */
	 */
	ATA_SPINUP_WAIT		= 8000,
	ATA_SPINUP_WAIT		= 8000,
	
	/* Horkage types. May be set by libata or controller on drives
	   (some horkage may be drive/controller pair dependant */

	ATA_HORKAGE_DIAGNOSTIC	= (1 << 0),	/* Failed boot diag */
};
};


enum hsm_task_states {
enum hsm_task_states {
@@ -476,6 +481,7 @@ struct ata_device {


	/* error history */
	/* error history */
	struct ata_ering	ering;
	struct ata_ering	ering;
	unsigned int		horkage;	/* List of broken features */
};
};


/* Offset into struct ata_device.  Fields above it are maintained
/* Offset into struct ata_device.  Fields above it are maintained