From 18301f742e5afebe8b144fddb9bdd6b8def5a8e4 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Mon, 18 Apr 2011 16:00:46 +0000 Subject: [PATCH] Handle ready timeout during polled operation same as done in mvs(4) before. --- sys/dev/ahci/ahci.c | 5 +++++ sys/dev/ahci/ahci.h | 1 + 2 files changed, 6 insertions(+) diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c index 9cb2c66d7654..e765a324c709 100644 --- a/sys/dev/ahci/ahci.c +++ b/sys/dev/ahci/ahci.c @@ -2856,4 +2856,9 @@ ahcipoll(struct cam_sim *sim) struct ahci_channel *ch = (struct ahci_channel *)cam_sim_softc(sim); ahci_ch_intr(ch->dev); + if (ch->resetting != 0 && + (--ch->resetpolldiv <= 0 || !callout_pending(&ch->reset_timer))) { + ch->resetpolldiv = 1000; + ahci_reset_to(ch->dev); + } } diff --git a/sys/dev/ahci/ahci.h b/sys/dev/ahci/ahci.h index cea01a12f5de..4e62cbf74a7a 100644 --- a/sys/dev/ahci/ahci.h +++ b/sys/dev/ahci/ahci.h @@ -414,6 +414,7 @@ struct ahci_channel { int lastslot; /* Last used slot */ int taggedtarget; /* Last tagged target */ int resetting; /* Hard-reset in progress. */ + int resetpolldiv; /* Hard-reset poll divider. */ int listening; /* SUD bit is cleared. */ union ccb *frozen; /* Frozen command */ struct callout pm_timer; /* Power management events */