summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-11-11 17:54:55 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-11-11 17:54:55 +0000
commit35c93cf738e694c577c6115391f6d6ba40dc0e0f (patch)
treeb1cd019d16ac9ad0aec94b3baf97e2c2dcbe4a50 /sys/dev
parentb37d7f96fb3abe514655717c4b8cf821c6eae0ca (diff)
DEC 3000/400 has a 22.5MHz TURBOchannel bus instead of the usual 25MHz;
correctly report this. Then, in asc@tc, compute synchronous transfer periods (involving the bus clock) with a better accuracy. ok krw@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/tc/asc_tc.c16
-rw-r--r--sys/dev/tc/tc.c8
-rw-r--r--sys/dev/tc/tcvar.h9
3 files changed, 19 insertions, 14 deletions
diff --git a/sys/dev/tc/asc_tc.c b/sys/dev/tc/asc_tc.c
index caaee612c4e..c5c3591b267 100644
--- a/sys/dev/tc/asc_tc.c
+++ b/sys/dev/tc/asc_tc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asc_tc.c,v 1.10 2010/06/28 18:31:02 krw Exp $ */
+/* $OpenBSD: asc_tc.c,v 1.11 2010/11/11 17:54:54 miod Exp $ */
/* $NetBSD: asc_tc.c,v 1.19 2001/11/15 09:48:19 lukem Exp $ */
/*-
@@ -140,10 +140,7 @@ asc_tc_attach(parent, self, aux)
self->dv_xname);
sc->sc_id = 7;
- sc->sc_freq = (ta->ta_busspeed) ? 25000000 : 12500000;
-
- /* gimme MHz */
- sc->sc_freq /= 1000000;
+ sc->sc_freq = TC_SPEED_TO_KHZ(ta->ta_busspeed); /* in kHz so far */
/*
* XXX More of this should be in ncr53c9x_attach(), but
@@ -171,13 +168,16 @@ asc_tc_attach(parent, self, aux)
* in "clocks per byte", and has a minimum value of 4.
* The SCSI period used in negotiation is one-fourth
* of the time (in nanoseconds) needed to transfer one byte.
- * Since the chip's clock is given in MHz, we have the following
- * formula: 4 * period = (1000 / freq) * 4
+ * Since the chip's clock is given in kHz, we have the following
+ * formula: 4 * period = (1000000 / freq) * 4
*/
- sc->sc_minsync = (1000 / sc->sc_freq) * 5 / 4;
+ sc->sc_minsync = (1000000 / sc->sc_freq) * 5 / 4;
sc->sc_maxxfer = 64 * 1024;
+ /* convert sc_freq to MHz */
+ sc->sc_freq /= 1000;
+
/* Do the common parts of attachment. */
ncr53c9x_attach(sc, &asc_switch);
}
diff --git a/sys/dev/tc/tc.c b/sys/dev/tc/tc.c
index 89765bafc6a..399378b40b2 100644
--- a/sys/dev/tc/tc.c
+++ b/sys/dev/tc/tc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tc.c,v 1.19 2010/09/22 12:36:32 miod Exp $ */
+/* $OpenBSD: tc.c,v 1.20 2010/11/11 17:54:54 miod Exp $ */
/* $NetBSD: tc.c,v 1.29 2001/11/13 06:26:10 lukem Exp $ */
/*
@@ -81,8 +81,10 @@ tcattach(parent, self, aux)
tc_addr_t tcaddr;
int i;
- printf(": %s MHz clock\n",
- tba->tba_speed == TC_SPEED_25_MHZ ? "25" : "12.5");
+ if (tba->tba_speed & 1)
+ printf(": %d.5 MHz clock\n", tba->tba_speed / 2);
+ else
+ printf(": %d MHz clock\n", tba->tba_speed / 2);
/*
* Save important CPU/chipset information.
diff --git a/sys/dev/tc/tcvar.h b/sys/dev/tc/tcvar.h
index f9d73392f23..6fa495db155 100644
--- a/sys/dev/tc/tcvar.h
+++ b/sys/dev/tc/tcvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcvar.h,v 1.15 2010/09/22 12:36:32 miod Exp $ */
+/* $OpenBSD: tcvar.h,v 1.16 2010/11/11 17:54:54 miod Exp $ */
/* $NetBSD: tcvar.h,v 1.17 2000/06/04 19:15:15 cgd Exp $ */
/*
@@ -136,7 +136,10 @@ void tc_intr_disestablish(struct device *, void *, const char *);
/*
* Miscellaneous definitions.
*/
-#define TC_SPEED_12_5_MHZ 0 /* 12.5MHz TC bus */
-#define TC_SPEED_25_MHZ 1 /* 25MHz TC bus */
+#define TC_SPEED_12_5_MHZ 25 /* 12.5MHz TC bus */
+#define TC_SPEED_22_5_MHZ 45 /* 22.5MHz TC bus */
+#define TC_SPEED_25_MHZ 50 /* 25MHz TC bus */
+
+#define TC_SPEED_TO_KHZ(s) ((s) * (1000 / 2))
#endif /* __DEV_TC_TCVAR_H__ */