Skip to contentSkip to conversation

ata_piix: implement ignore_PCS driver option

PATCH In review Tejun Heo 2 participants 3 messages Feb 12, 2006

Subsystems (2)
lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

PATCH 1/1 ata_piix: implement ignore_PCS driver option

On some configurations, ICH5 SATA incorrectly reports 0 for PCS even when ports are active and operational. This patch adds a driver parameter which, when set, causes ata_piix ignore PCS value and proceed with device probing.

---

This patch is against
the current upstream (bef4a456b8dc8b3638f4d49a25a89e1467da9483)
+ http://article.gmane.org/gmane.linux.ide/7967
+ http://article.gmane.org/gmane.linux.ide/7968 (2 patches)
+ http://article.gmane.org/gmane.linux.ide/7970

 drivers/scsi/ata_piix.c |   11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/scsi/ata_piix.c +11 -0
Index: work1/drivers/scsi/ata_piix.c
===================================================================
@@ -330,6 +330,11 @@ MODULE_LICENSE("GPL");
 MODULE_DEVICE_TABLE(pci, piix_pci_tbl);
 MODULE_VERSION(DRV_VERSION);
 
+static int ignore_PCS = 0;
+module_param(ignore_PCS, int, 0444);
+MODULE_PARM_DESC(ignore_PCS, "ignore PCS register to force device probing, "
+			     "useful on some ICH5 SATA setups (0=off, 1=on)");
+
 /**
  *	piix_pata_cbl_detect - Probe host controller cable detect info
  *	@ap: Port for which cable detect info is desired
@@ -428,6 +433,12 @@ static int piix_sata_probe (struct ata_p
 	pci_read_config_byte(pdev, ICH5_PCS, &pcs);
 	orig_mask = (int) pcs & 0xff;
 
+	if (ignore_PCS) {
+		printk(KERN_INFO "ata%u: ignoring PIIX PCS (0x%x)\n",
+		       ap->id, pcs);
+		return 1;
+	}
+
 	/* TODO: this is vaguely wrong for ICH6 combined mode,
 	 * where only two of the four SATA ports are mapped
 	 * onto a single ATA channel.  It is also vaguely inaccurate
author
#1 lore raw

PATCH 1/1 ata_piix: add information message about PCS

So far, the incorrect PCS problem has only been reported on two ICH5 SATA setups and masked PCS was zero in both cases. This patch makes ata_piix print an information message about ignore_PCS option in such cases.

---

Jeff, this patch makes ata_piix advertise about ignore_PCS option if the PCS value seems suspicious on ICH5 sata. IMHO, this can make lives much easier for those who are trying to figure out this rather obscure problem with small amount of added code.

 drivers/scsi/ata_piix.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/ata_piix.c +7 -1
Index: work1/drivers/scsi/ata_piix.c
===================================================================
@@ -101,6 +101,7 @@ enum {
 	ICH5_PCS		= 0x92,	/* port control and status */
 	PIIX_SCC		= 0x0A, /* sub-class code register */
 
+	PIIX_FLAG_FLAKY_PCS	= (1 << 26), /* PCS reportedly flaky */
 	PIIX_FLAG_AHCI		= (1 << 27), /* AHCI possible */
 	PIIX_FLAG_CHECKINTR	= (1 << 28), /* make sure PCI INTx enabled */
 	PIIX_FLAG_COMBINED	= (1 << 29), /* combined mode possible */
@@ -274,7 +275,7 @@ static struct ata_port_info piix_port_in
 	{
 		.sht		= &piix_sht,
 		.host_flags	= ATA_FLAG_SATA | PIIX_FLAG_COMBINED |
-				  PIIX_FLAG_CHECKINTR,
+				  PIIX_FLAG_CHECKINTR | PIIX_FLAG_FLAKY_PCS,
 		.pio_mask	= 0x1f,	/* pio0-4 */
 		.mwdma_mask	= 0x07, /* mwdma0-2 */
 		.udma_mask	= 0x7f,	/* udma0-6 */
@@ -439,6 +440,11 @@ static int piix_sata_probe (struct ata_p
 		return 1;
 	}
 
+	if (orig_mask == 0 && ap->flags & PIIX_FLAG_FLAKY_PCS)
+		printk(KERN_INFO "ata%u: PIIX PCS is 0x%x, consider using "
+		       "ignore_PCS option to force device probing\n",
+		       ap->id, pcs);
+
 	/* TODO: this is vaguely wrong for ICH6 combined mode,
 	 * where only two of the four SATA ports are mapped
 	 * onto a single ATA channel.  It is also vaguely inaccurate
#2 lore raw
In reply to Tejun Heo
Quoted 6 lines · Tejun Heo

On some configurations, ICH5 SATA incorrectly reports 0 for PCS even when ports are active and operational. This patch adds a driver parameter which, when set, causes ata_piix ignore PCS value and proceed with device probing.

Given my comments in the last email, after reviewing the docs, I think we should fix ata_piix SATA probe behavior before considering this patch. Fixing ata_piix may make this patch unnecessary.

Jeff