summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2014-12-17 03:50:54 +0000
committerBrad Smith <brad@cvs.openbsd.org>2014-12-17 03:50:54 +0000
commit954e35e828b3b54108c147fa0bf1047e6366ec83 (patch)
treeb61cc1d0dcdf71a3aa8c7d3855ecd360beae50fc /sys/dev/pci
parent0743136a9ed96c6c1df5652af835705427085585 (diff)
Do as the datasheet recommends and disable the RX filter before adjusting
the RX filter. From FreeBSD
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_sis.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c
index 2524b9d8bea..c8d0bea6e24 100644
--- a/sys/dev/pci/if_sis.c
+++ b/sys/dev/pci/if_sis.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sis.c,v 1.119 2014/12/08 10:58:45 brad Exp $ */
+/* $OpenBSD: if_sis.c,v 1.120 2014/12/17 03:50:53 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@@ -334,12 +334,16 @@ sis_read_cmos(struct sis_softc *sc, struct pci_attach_args *pa,
void
sis_read_mac(struct sis_softc *sc, struct pci_attach_args *pa)
{
+ uint32_t rxfilt, csrsave;
u_int16_t *enaddr = (u_int16_t *) &sc->arpcom.ac_enaddr;
- SIS_SETBIT(sc, SIS_CSR, SIS_CSR_RELOAD);
- SIS_CLRBIT(sc, SIS_CSR, SIS_CSR_RELOAD);
+ rxfilt = CSR_READ_4(sc, SIS_RXFILT_CTL);
+ csrsave = CSR_READ_4(sc, SIS_CSR);
+
+ CSR_WRITE_4(sc, SIS_CSR, SIS_CSR_RELOAD | csrsave);
+ CSR_WRITE_4(sc, SIS_CSR, 0);
- SIS_CLRBIT(sc, SIS_RXFILT_CTL, SIS_RXFILTCTL_ENABLE);
+ CSR_WRITE_4(sc, SIS_RXFILT_CTL, rxfilt & ~SIS_RXFILTCTL_ENABLE);
CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR0);
enaddr[0] = letoh16(CSR_READ_4(sc, SIS_RXFILT_DATA) & 0xffff);
@@ -348,7 +352,8 @@ sis_read_mac(struct sis_softc *sc, struct pci_attach_args *pa)
CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR2);
enaddr[2] = letoh16(CSR_READ_4(sc, SIS_RXFILT_DATA) & 0xffff);
- SIS_SETBIT(sc, SIS_RXFILT_CTL, SIS_RXFILTCTL_ENABLE);
+ CSR_WRITE_4(sc, SIS_RXFILT_CTL, rxfilt);
+ CSR_WRITE_4(sc, SIS_CSR, csrsave);
}
void
@@ -790,6 +795,13 @@ sis_iff_ns(struct sis_softc *sc)
int bit, index;
rxfilt = CSR_READ_4(sc, SIS_RXFILT_CTL);
+ if (rxfilt & SIS_RXFILTCTL_ENABLE) {
+ /*
+ * Filter should be disabled to program other bits.
+ */
+ CSR_WRITE_4(sc, SIS_RXFILT_CTL, rxfilt & ~SIS_RXFILTCTL_ENABLE);
+ CSR_READ_4(sc, SIS_RXFILT_CTL);
+ }
rxfilt &= ~(SIS_RXFILTCTL_ALLMULTI | SIS_RXFILTCTL_ALLPHYS |
NS_RXFILTCTL_ARP | SIS_RXFILTCTL_BROAD | NS_RXFILTCTL_MCHASH |
NS_RXFILTCTL_PERFECT);
@@ -817,7 +829,7 @@ sis_iff_ns(struct sis_softc *sc)
/* first, zot all the existing hash bits */
for (i = 0; i < 32; i++) {
- CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_FMEM_LO + (i*2));
+ CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_FMEM_LO + (i * 2));
CSR_WRITE_4(sc, SIS_RXFILT_DATA, 0);
}
@@ -840,6 +852,7 @@ sis_iff_ns(struct sis_softc *sc)
}
CSR_WRITE_4(sc, SIS_RXFILT_CTL, rxfilt);
+ CSR_READ_4(sc, SIS_RXFILT_CTL);
}
void
@@ -860,6 +873,13 @@ sis_iff_sis(struct sis_softc *sc)
maxmulti = 8;
rxfilt = CSR_READ_4(sc, SIS_RXFILT_CTL);
+ if (rxfilt & SIS_RXFILTCTL_ENABLE) {
+ /*
+ * Filter should be disabled to program other bits.
+ */
+ CSR_WRITE_4(sc, SIS_RXFILT_CTL, rxfilt & ~SIS_RXFILTCTL_ENABLE);
+ CSR_READ_4(sc, SIS_RXFILT_CTL);
+ }
rxfilt &= ~(SIS_RXFILTCTL_ALLMULTI | SIS_RXFILTCTL_ALLPHYS |
SIS_RXFILTCTL_BROAD);
ifp->if_flags &= ~IFF_ALLMULTI;
@@ -898,6 +918,7 @@ sis_iff_sis(struct sis_softc *sc)
}
CSR_WRITE_4(sc, SIS_RXFILT_CTL, rxfilt);
+ CSR_READ_4(sc, SIS_RXFILT_CTL);
}
void