fix interrupt moderation timer frequencies for Yukon
Obtained from: OpenBSD
This commit is contained in:
parent
878793bc2f
commit
c57c874824
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user