From 2b3b0f1721dc40433b6f4b8efc8cc65fa0be9b57 Mon Sep 17 00:00:00 2001 From: Scott Long Date: Wed, 14 Sep 2005 05:46:28 +0000 Subject: [PATCH] Use time_uptime for timing commands instead of time_second. This is a bit risky because the "current time" is supposed to be fed to the card during initialization, and the current time is supposed to be put into each command that is sent to the card. Hopefully either the card doesn't actually care about the timestamps, or it doesn't care about the absolute values so long and the relative values are consistent. Not an MFC candidate until more thorough testing can be done. --- sys/dev/aac/aac.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index d8e1d1afc631..e8d36070e660 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -925,7 +925,7 @@ aac_bio_command(struct aac_softc *sc, struct aac_command **cmp) cm->cm_datalen = bp->bio_bcount; cm->cm_complete = aac_bio_complete; cm->cm_private = bp; - cm->cm_timestamp = time_second; + cm->cm_timestamp = time_uptime; cm->cm_queue = AAC_ADAP_NORM_CMD_QUEUE; /* build the FIB */ @@ -1426,7 +1426,7 @@ aac_init(struct aac_softc *sc) /* * First wait for the adapter to come ready. */ - then = time_second; + then = time_uptime; do { code = AAC_GET_FWSTATUS(sc); if (code & AAC_SELF_TEST_FAILED) { @@ -1438,7 +1438,7 @@ aac_init(struct aac_softc *sc) "FATAL: controller kernel panic\n"); return(ENXIO); } - if (time_second > (then + AAC_BOOT_TIMEOUT)) { + if (time_uptime > (then + AAC_BOOT_TIMEOUT)) { device_printf(sc->aac_dev, "FATAL: controller not coming ready, " "status %x\n", code); @@ -1573,7 +1573,7 @@ aac_init(struct aac_softc *sc) ip->HostPhysMemPages = (ip->HostPhysMemPages + AAC_PAGE_SIZE) / AAC_PAGE_SIZE; } - ip->HostElapsedSeconds = time_second; /* reset later if invalid */ + ip->HostElapsedSeconds = time_uptime; /* reset later if invalid */ /* * Initialise FIB queues. Note that it appears that the layout of the @@ -1701,9 +1701,9 @@ aac_sync_command(struct aac_softc *sc, u_int32_t command, AAC_QNOTIFY(sc, AAC_DB_SYNC_COMMAND); /* spin waiting for the command to complete */ - then = time_second; + then = time_uptime; do { - if (time_second > (then + AAC_IMMEDIATE_TIMEOUT)) { + if (time_uptime > (then + AAC_IMMEDIATE_TIMEOUT)) { debug(1, "timed out"); return(EIO); } @@ -1997,14 +1997,14 @@ aac_timeout(struct aac_softc *sc) * only. */ timedout = 0; - deadline = time_second - AAC_CMD_TIMEOUT; + deadline = time_uptime - AAC_CMD_TIMEOUT; TAILQ_FOREACH(cm, &sc->aac_busy, cm_link) { if ((cm->cm_timestamp < deadline) /* && !(cm->cm_flags & AAC_CMD_TIMEDOUT) */) { cm->cm_flags |= AAC_CMD_TIMEDOUT; device_printf(sc->aac_dev, "COMMAND %p TIMEOUT AFTER %d SECONDS\n", - cm, (int)(time_second-cm->cm_timestamp)); + cm, (int)(time_uptime-cm->cm_timestamp)); AAC_PRINT_FIB(sc, cm->cm_fib); timedout++; } @@ -2602,7 +2602,7 @@ aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib) if ((error = copyin(ufib, cm->cm_fib, size)) != 0) goto out; cm->cm_fib->Header.Size = size; - cm->cm_timestamp = time_second; + cm->cm_timestamp = time_uptime; /* * Pass the FIB to the controller, wait for it to complete.