summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/pci/if_sk.c29
-rw-r--r--sys/dev/pci/if_skreg.h9
2 files changed, 28 insertions, 10 deletions
diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c
index cd42a26d5f2..58a7fe192cf 100644
--- a/sys/dev/pci/if_sk.c
+++ b/sys/dev/pci/if_sk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sk.c,v 1.87 2005/11/15 20:32:04 brad Exp $ */
+/* $OpenBSD: if_sk.c,v 1.88 2005/11/26 19:16:28 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -1045,6 +1045,8 @@ skc_probe(struct device *parent, void *match, void *aux)
*/
void sk_reset(struct sk_softc *sc)
{
+ u_int32_t imtimer_ticks;
+
DPRINTFN(2, ("sk_reset\n"));
CSR_WRITE_2(sc, SK_CSR, SK_CSR_SW_RESET);
@@ -1076,17 +1078,30 @@ void sk_reset(struct sk_softc *sc)
sk_win_write_4(sc, SK_RAMCTL, SK_RAMCTL_UNRESET);
/*
- * Configure interrupt moderation. The moderation timer
+ * Configure interrupt moderation. The moderation timer
* defers interrupts specified in the interrupt moderation
* timer mask based on the timeout specified in the interrupt
* moderation timer init register. Each bit in the timer
- * register represents 18.825ns, so to specify a timeout in
- * microseconds, we have to multiply by 54.
+ * register represents one tick, so to specify a timeout in
+ * microseconds, we have to multiply by the correct number of
+ * ticks-per-microsecond.
*/
- sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(100));
- sk_win_write_4(sc, SK_IMMR, SK_ISR_TX1_S_EOF|SK_ISR_TX2_S_EOF|
+ switch (sc->sk_type) {
+ case SK_GENESIS:
+ imtimer_ticks = SK_IMTIMER_TICKS_GENESIS;
+ break;
+ case SK_YUKON_EC:
+ case SK_YUKON_XL:
+ case SK_YUKON_FE:
+ imtimer_ticks = SK_IMTIMER_TICKS_YUKON_EC;
+ break;
+ default:
+ imtimer_ticks = SK_IMTIMER_TICKS_YUKON;
+ }
+ sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(100));
+ sk_win_write_4(sc, SK_IMMR, SK_ISR_TX1_S_EOF|SK_ISR_TX2_S_EOF|
SK_ISR_RX1_EOF|SK_ISR_RX2_EOF);
- sk_win_write_1(sc, SK_IMTIMERCTL, SK_IMCTL_START);
+ sk_win_write_1(sc, SK_IMTIMERCTL, SK_IMCTL_START);
}
int
diff --git a/sys/dev/pci/if_skreg.h b/sys/dev/pci/if_skreg.h
index 32df2c2bd0f..7aea4147dcf 100644
--- a/sys/dev/pci/if_skreg.h
+++ b/sys/dev/pci/if_skreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_skreg.h,v 1.24 2005/10/15 23:09:17 brad Exp $ */
+/* $OpenBSD: if_skreg.h,v 1.25 2005/11/26 19:16:28 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -335,8 +335,11 @@
#define SK_IMCTL_STOP 0x02
#define SK_IMCTL_START 0x04
-#define SK_IMTIMER_TICKS 54
-#define SK_IM_USECS(x) ((x) * SK_IMTIMER_TICKS)
+/* Number of ticks per usec for interrupt moderation */
+#define SK_IMTIMER_TICKS_GENESIS 53
+#define SK_IMTIMER_TICKS_YUKON 78
+#define SK_IMTIMER_TICKS_YUKON_EC 125
+#define SK_IM_USECS(x) ((x) * imtimer_ticks)
/*
* The SK_EPROM0 register contains a byte that describes the