diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 83bc49f..6e6b593 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c @@ -174,7 +174,8 @@ static int piix_sidpr_scr_read(struct ata_link *link, unsigned int reg, u32 *val); static int piix_sidpr_scr_write(struct ata_link *link, unsigned int reg, u32 val); -static bool piix_irq_check(struct ata_port *ap); +static int piix_sidpr_hardreset(struct ata_link *link, unsigned int *class, + unsigned long deadline);static bool piix_irq_check(struct ata_port *ap); #ifdef CONFIG_PM static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); static int piix_pci_device_resume(struct pci_dev *pdev); @@ -345,9 +346,9 @@ static struct ata_port_operations ich_pata_ops = { static struct ata_port_operations piix_sidpr_sata_ops = { .inherits = &piix_sata_ops, - .hardreset = sata_std_hardreset, .scr_read = piix_sidpr_scr_read, .scr_write = piix_sidpr_scr_write, + .hardreset = piix_sidpr_hardreset, }; static const struct piix_map_db ich5_map_db = { @@ -981,6 +982,18 @@ static bool piix_irq_check(struct ata_port *ap) return ap->ops->bmdma_status(ap) & ATA_DMA_INTR; } +static int piix_sidpr_hardreset(struct ata_link *link, unsigned int *class, + unsigned long deadline) +{ + const unsigned long *timing = sata_deb_timing_long; + bool online; + int rc; + + /* do hardreset */ + rc = sata_link_hardreset(link, timing, deadline, &online, NULL); + return online ? -EAGAIN : rc; +} + #ifdef CONFIG_PM static int piix_broken_suspend(void) { diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 49cffb6..2ba4284 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -3738,7 +3738,7 @@ int sata_link_debounce(struct ata_link *link, const unsigned long *params, unsigned long interval = params[0]; unsigned long duration = params[1]; unsigned long last_jiffies, t; - u32 last, cur; + u32 last, cur, xxx; int rc; t = ata_deadline(jiffies, params[2]); @@ -3747,7 +3747,9 @@ int sata_link_debounce(struct ata_link *link, const unsigned long *params, if ((rc = sata_scr_read(link, SCR_STATUS, &cur))) return rc; + xxx = cur; cur &= 0xf; + ata_link_printk(link, KERN_INFO, "XXX debounce start, SStatus=%x\n", xxx); last = cur; last_jiffies = jiffies; @@ -3756,6 +3758,7 @@ int sata_link_debounce(struct ata_link *link, const unsigned long *params, msleep(interval); if ((rc = sata_scr_read(link, SCR_STATUS, &cur))) return rc; + xxx = cur; cur &= 0xf; /* DET stable? */ @@ -3763,8 +3766,12 @@ int sata_link_debounce(struct ata_link *link, const unsigned long *params, if (cur == 1 && time_before(jiffies, deadline)) continue; if (time_after(jiffies, - ata_deadline(last_jiffies, duration))) + ata_deadline(last_jiffies, duration))) { + ata_link_printk(link, KERN_INFO, + "XXX debounce done, SStatus=%x, DET stable for %u msecs\n", + xxx, jiffies_to_msecs(jiffies - last_jiffies)); return 0; + } continue; }