summaryrefslogtreecommitdiffstats
path: root/sys/dev/ahci/ahci.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2011-04-19 10:51:19 +0000
committermav <mav@FreeBSD.org>2011-04-19 10:51:19 +0000
commit0b4c44825012153bafde75c6c26c6b0a1e1d2176 (patch)
tree7549ee020d8cbad90928d9cd3f34de5409f92bbf /sys/dev/ahci/ahci.c
parentcc8f016bc18d45715487b51cf1921fa81a59259d (diff)
downloadFreeBSD-src-0b4c44825012153bafde75c6c26c6b0a1e1d2176.zip
FreeBSD-src-0b4c44825012153bafde75c6c26c6b0a1e1d2176.tar.gz
According to specification. device should respond to COMRESET with COMINIT
in no more then 10ms. If we detected no device presence within that time, there is no reason to wait longer.
Diffstat (limited to 'sys/dev/ahci/ahci.c')
-rw-r--r--sys/dev/ahci/ahci.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c
index ac200cb..c7a6977 100644
--- a/sys/dev/ahci/ahci.c
+++ b/sys/dev/ahci/ahci.c
@@ -2580,11 +2580,13 @@ static int
ahci_sata_connect(struct ahci_channel *ch)
{
u_int32_t status;
- int timeout;
+ int timeout, found = 0;
/* Wait up to 100ms for "connect well" */
for (timeout = 0; timeout < 1000 ; timeout++) {
status = ATA_INL(ch->r_mem, AHCI_P_SSTS);
+ if ((status & ATA_SS_DET_MASK) != ATA_SS_DET_NO_DEVICE)
+ found = 1;
if (((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_ONLINE) &&
((status & ATA_SS_SPD_MASK) != ATA_SS_SPD_NO_SPEED) &&
((status & ATA_SS_IPM_MASK) == ATA_SS_IPM_ACTIVE))
@@ -2596,12 +2598,15 @@ ahci_sata_connect(struct ahci_channel *ch)
}
return (0);
}
+ if (found == 0 && timeout >= 100)
+ break;
DELAY(100);
}
- if (timeout >= 1000) {
+ if (timeout >= 1000 || !found) {
if (bootverbose) {
- device_printf(ch->dev, "SATA connect timeout status=%08x\n",
- status);
+ device_printf(ch->dev,
+ "SATA connect timeout time=%dus status=%08x\n",
+ timeout * 100, status);
}
return (0);
}
OpenPOWER on IntegriCloud