diff options
author | yongari <yongari@FreeBSD.org> | 2006-01-17 05:57:44 +0000 |
---|---|---|
committer | yongari <yongari@FreeBSD.org> | 2006-01-17 05:57:44 +0000 |
commit | 59ed58107d8b7794fc2345a726260f59b5ee66ff (patch) | |
tree | 5c5e5720d17e7607345e5fbbcac7ad61601f3081 | |
parent | 70e553d66e099e0617e396b96a1b64fa0463b8c2 (diff) | |
download | FreeBSD-src-59ed58107d8b7794fc2345a726260f59b5ee66ff.zip FreeBSD-src-59ed58107d8b7794fc2345a726260f59b5ee66ff.tar.gz |
fix interrupt moderation timer frequencies for Yukon
Obtained from: OpenBSD
-rw-r--r-- | sys/dev/sk/if_sk.c | 21 | ||||
-rw-r--r-- | sys/dev/sk/if_skreg.h | 7 | ||||
-rw-r--r-- | sys/pci/if_sk.c | 21 | ||||
-rw-r--r-- | sys/pci/if_skreg.h | 7 |
4 files changed, 42 insertions, 14 deletions
diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index 9bda99b..94d9bae 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -1365,13 +1365,23 @@ sk_reset(sc) * 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. */ + switch (sc->sk_type) { + case SK_GENESIS: + sc->sk_int_ticks = SK_IMTIMER_TICKS_GENESIS; + break; + default: + sc->sk_int_ticks = SK_IMTIMER_TICKS_YUKON; + break; + } if (bootverbose) printf("skc%d: interrupt moderation is %d us\n", sc->sk_unit, sc->sk_int_mod); - sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(sc->sk_int_mod)); + sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(sc->sk_int_mod, + sc->sk_int_ticks)); 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); @@ -2905,8 +2915,9 @@ sk_init_locked(sc_if) /* Set interrupt moderation if changed via sysctl. */ /* SK_LOCK(sc); */ imr = sk_win_read_4(sc, SK_IMTIMERINIT); - if (imr != SK_IM_USECS(sc->sk_int_mod)) { - sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(sc->sk_int_mod)); + if (imr != SK_IM_USECS(sc->sk_int_mod, sc->sk_int_ticks)) { + sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(sc->sk_int_mod, + sc->sk_int_ticks)); if (bootverbose) printf("skc%d: interrupt moderation is %d us\n", sc->sk_unit, sc->sk_int_mod); diff --git a/sys/dev/sk/if_skreg.h b/sys/dev/sk/if_skreg.h index 1c7158e..3b5cc41 100644 --- a/sys/dev/sk/if_skreg.h +++ b/sys/dev/sk/if_skreg.h @@ -378,8 +378,10 @@ #define SK_IMCTL_STOP 0x02 #define SK_IMCTL_START 0x04 -#define SK_IMTIMER_TICKS 54 -#define SK_IM_USECS(x) ((x) * SK_IMTIMER_TICKS) +#define SK_IMTIMER_TICKS_GENESIS 53 +#define SK_IMTIMER_TICKS_YUKON 78 +#define SK_IMTIMER_TICKS_YUKON_EC 128 +#define SK_IM_USECS(x, t) ((x) * (t)) #define SK_IM_MIN 10 #define SK_IM_DEFAULT 100 @@ -1452,6 +1454,7 @@ struct sk_softc { u_int32_t sk_pmd; /* physical media type */ u_int32_t sk_intrmask; int sk_int_mod; + int sk_int_ticks; struct sk_if_softc *sk_if[2]; device_t sk_devs[2]; struct mtx sk_mtx; diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c index 9bda99b..94d9bae 100644 --- a/sys/pci/if_sk.c +++ b/sys/pci/if_sk.c @@ -1365,13 +1365,23 @@ sk_reset(sc) * 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. */ + switch (sc->sk_type) { + case SK_GENESIS: + sc->sk_int_ticks = SK_IMTIMER_TICKS_GENESIS; + break; + default: + sc->sk_int_ticks = SK_IMTIMER_TICKS_YUKON; + break; + } if (bootverbose) printf("skc%d: interrupt moderation is %d us\n", sc->sk_unit, sc->sk_int_mod); - sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(sc->sk_int_mod)); + sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(sc->sk_int_mod, + sc->sk_int_ticks)); 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); @@ -2905,8 +2915,9 @@ sk_init_locked(sc_if) /* Set interrupt moderation if changed via sysctl. */ /* SK_LOCK(sc); */ imr = sk_win_read_4(sc, SK_IMTIMERINIT); - if (imr != SK_IM_USECS(sc->sk_int_mod)) { - sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(sc->sk_int_mod)); + if (imr != SK_IM_USECS(sc->sk_int_mod, sc->sk_int_ticks)) { + sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(sc->sk_int_mod, + sc->sk_int_ticks)); if (bootverbose) printf("skc%d: interrupt moderation is %d us\n", sc->sk_unit, sc->sk_int_mod); diff --git a/sys/pci/if_skreg.h b/sys/pci/if_skreg.h index 1c7158e..3b5cc41 100644 --- a/sys/pci/if_skreg.h +++ b/sys/pci/if_skreg.h @@ -378,8 +378,10 @@ #define SK_IMCTL_STOP 0x02 #define SK_IMCTL_START 0x04 -#define SK_IMTIMER_TICKS 54 -#define SK_IM_USECS(x) ((x) * SK_IMTIMER_TICKS) +#define SK_IMTIMER_TICKS_GENESIS 53 +#define SK_IMTIMER_TICKS_YUKON 78 +#define SK_IMTIMER_TICKS_YUKON_EC 128 +#define SK_IM_USECS(x, t) ((x) * (t)) #define SK_IM_MIN 10 #define SK_IM_DEFAULT 100 @@ -1452,6 +1454,7 @@ struct sk_softc { u_int32_t sk_pmd; /* physical media type */ u_int32_t sk_intrmask; int sk_int_mod; + int sk_int_ticks; struct sk_if_softc *sk_if[2]; device_t sk_devs[2]; struct mtx sk_mtx; |