Re: libata dev_config call order wrong.

From: Jeff Garzik
Date: Sun Aug 29 2004 - 13:29:08 EST


Jeff Garzik wrote:
me either, unless I can figure out a way to detect that a disk is PATA not SATA. Nothing is obvious from the specs on www.t13.org, but who knows.

According to the Serial ATA docs, IDENTIFY DEVICE word 93 will be zero if it's Serial ATA. Who knows if that's true, given the wierd wild world of ATA devices.

So, given the attached patch, you could try and create a generic ata_dev_config that all drivers call, that does something like

/* limit bridge transfers to udma5, 200 sectors */
if ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev))) {
printk(KERN_INFO "ata%u(%u): applying bridge limits\n",
ap->id, dev->devno);
ap->udma_mask &= ATA_UDMA5;
ap->host->max_sectors = ATA_MAX_SECTORS;
ap->host->hostt->max_sectors = ATA_MAX_SECTORS;
dev->flags |= ATA_DFLAG_LOCK_SECTORS;
}

Regards,

Jeff


===== include/linux/ata.h 1.17 vs edited =====
--- 1.17/include/linux/ata.h 2004-08-18 01:47:22 -04:00
+++ edited/include/linux/ata.h 2004-08-29 14:18:02 -04:00
@@ -218,6 +218,7 @@
};

#define ata_id_is_ata(dev) (((dev)->id[0] & (1 << 15)) == 0)
+#define ata_id_is_sata(dev) ((dev)->id[93] == 0)
#define ata_id_rahead_enabled(dev) ((dev)->id[85] & (1 << 6))
#define ata_id_wcache_enabled(dev) ((dev)->id[85] & (1 << 5))
#define ata_id_has_flush(dev) ((dev)->id[83] & (1 << 12))