summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>2004-11-18 20:22:31 +0000
committergibbs <gibbs@FreeBSD.org>2004-11-18 20:22:31 +0000
commitb2e3496e1c437e57b6d3c997f9346cdcafc26d27 (patch)
treefde9e868f64b670f4ef09bc63bae4b071be78050
parent84a128d3c473130ecff9bd938567431d9ed3704e (diff)
downloadFreeBSD-src-b2e3496e1c437e57b6d3c997f9346cdcafc26d27.zip
FreeBSD-src-b2e3496e1c437e57b6d3c997f9346cdcafc26d27.tar.gz
Revert to basing all timeout/timer values in ms rather than us. The switch
to us was to help out the Linux port, but really just invited overflow. In fact, the request sense timer was overflowing prior to this change making it much shorter than intended. aic_osm_lib.h: Be more careful about overflow in all timer/timeout primitives.
-rw-r--r--sys/dev/aic7xxx/aic79xx.c14
-rw-r--r--sys/dev/aic7xxx/aic79xx.h2
-rw-r--r--sys/dev/aic7xxx/aic7xxx.c6
-rw-r--r--sys/dev/aic7xxx/aic_osm_lib.h20
4 files changed, 26 insertions, 16 deletions
diff --git a/sys/dev/aic7xxx/aic79xx.c b/sys/dev/aic7xxx/aic79xx.c
index ca8e2a9..16b3046 100644
--- a/sys/dev/aic7xxx/aic79xx.c
+++ b/sys/dev/aic7xxx/aic79xx.c
@@ -6487,7 +6487,7 @@ ahd_init(struct ahd_softc *ahd)
}
init_done:
ahd_restart(ahd);
- aic_timer_reset(&ahd->stat_timer, AHD_STAT_UPDATE_US,
+ aic_timer_reset(&ahd->stat_timer, AHD_STAT_UPDATE_MS,
ahd_stat_timer, ahd);
return (0);
}
@@ -8055,7 +8055,7 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset)
}
-#define AHD_RESET_POLL_US 1000
+#define AHD_RESET_POLL_MS 1
static void
ahd_reset_poll(void *arg)
{
@@ -8077,7 +8077,7 @@ ahd_reset_poll(void *arg)
ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
ahd_outb(ahd, CLRSINT1, CLRSCSIRSTI);
if ((ahd_inb(ahd, SSTAT1) & SCSIRSTI) != 0) {
- aic_timer_reset(&ahd->reset_timer, AHD_RESET_POLL_US,
+ aic_timer_reset(&ahd->reset_timer, AHD_RESET_POLL_MS,
ahd_reset_poll, ahd);
ahd_unpause(ahd);
ahd_unlock(ahd, &s);
@@ -8135,7 +8135,7 @@ ahd_stat_timer(void *arg)
ahd->cmdcmplt_bucket = (ahd->cmdcmplt_bucket+1) & (AHD_STAT_BUCKETS-1);
ahd->cmdcmplt_total -= ahd->cmdcmplt_counts[ahd->cmdcmplt_bucket];
ahd->cmdcmplt_counts[ahd->cmdcmplt_bucket] = 0;
- aic_timer_reset(&ahd->stat_timer, AHD_STAT_UPDATE_US,
+ aic_timer_reset(&ahd->stat_timer, AHD_STAT_UPDATE_MS,
ahd_stat_timer, ahd);
ahd_unlock(ahd, &s);
ahd_list_unlock(&l);
@@ -8358,7 +8358,7 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)
*/
if (ahd->scb_data.recovery_scbs == 0
|| (scb->flags & SCB_RECOVERY_SCB) != 0)
- aic_scb_timer_reset(scb, 5 * 1000000);
+ aic_scb_timer_reset(scb, 5 * 1000);
break;
}
case SCSI_STATUS_OK:
@@ -9406,7 +9406,7 @@ bus_reset:
ahd_outb(ahd, SCSISIGO, last_phase|ATNO);
ahd_print_path(ahd, active_scb);
printf("BDR message in message buffer\n");
- aic_scb_timer_reset(scb, 2 * 1000000);
+ aic_scb_timer_reset(scb, 2 * 1000);
break;
} else if (last_phase != P_BUSFREE
&& ahd_inb(ahd, SCSIPHASE) == 0) {
@@ -9498,7 +9498,7 @@ bus_reset:
ahd_set_scbptr(ahd, active_scbptr);
ahd_print_path(ahd, scb);
printf("Queuing a BDR SCB\n");
- aic_scb_timer_reset(scb, 2 * 1000000);
+ aic_scb_timer_reset(scb, 2 * 1000);
break;
}
}
diff --git a/sys/dev/aic7xxx/aic79xx.h b/sys/dev/aic7xxx/aic79xx.h
index 3e17ba9..cecb691 100644
--- a/sys/dev/aic7xxx/aic79xx.h
+++ b/sys/dev/aic7xxx/aic79xx.h
@@ -1151,7 +1151,7 @@ struct ahd_softc {
/*
* Statistics.
*/
-#define AHD_STAT_UPDATE_US 250000 /* 250ms */
+#define AHD_STAT_UPDATE_MS 250
#define AHD_STAT_BUCKETS 4
u_int cmdcmplt_bucket;
uint32_t cmdcmplt_counts[AHD_STAT_BUCKETS];
diff --git a/sys/dev/aic7xxx/aic7xxx.c b/sys/dev/aic7xxx/aic7xxx.c
index 6a12d16..08ace3b 100644
--- a/sys/dev/aic7xxx/aic7xxx.c
+++ b/sys/dev/aic7xxx/aic7xxx.c
@@ -588,7 +588,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)
*/
if (ahc->scb_data->recovery_scbs == 0
|| (scb->flags & SCB_RECOVERY_SCB) != 0)
- aic_scb_timer_reset(scb, 5 * 1000000);
+ aic_scb_timer_reset(scb, 5 * 1000);
break;
}
default:
@@ -7155,7 +7155,7 @@ bus_reset:
ahc_print_path(ahc, active_scb);
printf("BDR message in message buffer\n");
active_scb->flags |= SCB_DEVICE_RESET;
- aic_scb_timer_reset(scb, 2 * 1000000);
+ aic_scb_timer_reset(scb, 2 * 1000);
} else if (last_phase != P_BUSFREE
&& (ahc_inb(ahc, SSTAT1) & REQINIT) == 0) {
/*
@@ -7257,7 +7257,7 @@ bus_reset:
printf("Queuing a BDR SCB\n");
ahc_qinfifo_requeue_tail(ahc, scb);
ahc_outb(ahc, SCBPTR, saved_scbptr);
- aic_scb_timer_reset(scb, 2 * 1000000);
+ aic_scb_timer_reset(scb, 2 * 1000);
} else {
/* Go "immediatly" to the bus reset */
/* This shouldn't happen */
diff --git a/sys/dev/aic7xxx/aic_osm_lib.h b/sys/dev/aic7xxx/aic_osm_lib.h
index f00d80b..86a2db4 100644
--- a/sys/dev/aic7xxx/aic_osm_lib.h
+++ b/sys/dev/aic7xxx/aic_osm_lib.h
@@ -199,24 +199,34 @@ static __inline u_int aic_get_timeout(struct scb *);
static __inline void aic_scb_timer_reset(struct scb *, u_int);
static __inline void
-aic_timer_reset(aic_timer_t *timer, u_int usec, aic_callback_t *func, void *arg)
+aic_timer_reset(aic_timer_t *timer, u_int msec, aic_callback_t *func, void *arg)
{
- callout_reset(timer, (usec * hz)/1000000, func, arg);
+ uint64_t time;
+
+ time = msec;
+ time *= hz;
+ time /= 1000;
+ callout_reset(timer, time, func, arg);
}
static __inline u_int
aic_get_timeout(struct scb *scb)
{
- return (scb->io_ctx->ccb_h.timeout * 1000);
+ return (scb->io_ctx->ccb_h.timeout);
}
static __inline void
-aic_scb_timer_reset(struct scb *scb, u_int usec)
+aic_scb_timer_reset(struct scb *scb, u_int msec)
{
+ uint64_t time;
+
+ time = msec;
+ time *= hz;
+ time /= 1000;
untimeout(aic_platform_timeout, (caddr_t)scb,
scb->io_ctx->ccb_h.timeout_ch);
scb->io_ctx->ccb_h.timeout_ch =
- timeout(aic_platform_timeout, scb, (usec * hz)/1000000);
+ timeout(aic_platform_timeout, scb, time);
}
static __inline void
OpenPOWER on IntegriCloud