Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev The 82801BA built-in Ethernet has a bug which requir...
details: https://anonhg.NetBSD.org/src/rev/b2c1cdeef8aa
branches: trunk
changeset: 510167:b2c1cdeef8aa
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon May 21 21:47:52 2001 +0000
description:
The 82801BA built-in Ethernet has a bug which requires us to
issue a NOP before a CU_RESUME when in 10baseT mode. Handle
this.
diffstat:
sys/dev/ic/i82557.c | 53 ++++++++++++++++++++++++++++++++++-------------
sys/dev/ic/i82557var.h | 11 ++++++---
sys/dev/pci/if_fxp_pci.c | 9 +++++++-
3 files changed, 53 insertions(+), 20 deletions(-)
diffs (195 lines):
diff -r 151f89c34170 -r b2c1cdeef8aa sys/dev/ic/i82557.c
--- a/sys/dev/ic/i82557.c Mon May 21 21:39:51 2001 +0000
+++ b/sys/dev/ic/i82557.c Mon May 21 21:47:52 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i82557.c,v 1.46 2001/05/21 20:59:38 thorpej Exp $ */
+/* $NetBSD: i82557.c,v 1.47 2001/05/21 21:47:52 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -226,6 +226,21 @@
}
/*
+ * Submit a command to the i82557.
+ */
+static __inline void
+fxp_scb_cmd(struct fxp_softc *sc, u_int8_t cmd)
+{
+
+ if (cmd == FXP_SCB_COMMAND_CU_RESUME &&
+ (sc->sc_flags & FXPF_FIX_RESUME_BUG) != 0) {
+ CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND, FXP_CB_COMMAND_NOP);
+ fxp_scb_wait(sc);
+ }
+ CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND, cmd);
+}
+
+/*
* Finish attaching an i82557 interface. Called by bus-specific front-end.
*/
void
@@ -850,7 +865,7 @@
* Issue a Resume command in case the chip was suspended.
*/
fxp_scb_wait(sc);
- CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND, FXP_SCB_COMMAND_CU_RESUME);
+ fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_RESUME);
/* Set a watchdog timer in case the chip flakes out. */
ifp->if_timer = 5;
@@ -1005,8 +1020,7 @@
CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL,
rxmap->dm_segs[0].ds_addr +
RFA_ALIGNMENT_FUDGE);
- CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND,
- FXP_SCB_COMMAND_RU_START);
+ fxp_scb_cmd(sc, FXP_SCB_COMMAND_RU_START);
}
/*
@@ -1142,8 +1156,7 @@
* Start another stats dump.
*/
FXP_CDSTATSSYNC(sc, BUS_DMASYNC_PREREAD);
- CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND,
- FXP_SCB_COMMAND_CU_DUMPRESET);
+ fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_DUMPRESET);
} else {
/*
* A previous command is still waiting to be accepted.
@@ -1302,10 +1315,10 @@
*/
fxp_scb_wait(sc);
CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, 0);
- CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND, FXP_SCB_COMMAND_CU_BASE);
+ fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_BASE);
fxp_scb_wait(sc);
- CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND, FXP_SCB_COMMAND_RU_BASE);
+ fxp_scb_cmd(sc, FXP_SCB_COMMAND_RU_BASE);
/*
* Initialize the multicast filter. Do this now, since we might
@@ -1330,7 +1343,7 @@
CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL,
sc->sc_cddma + FXP_CDSTATSOFF);
FXP_CDSTATSSYNC(sc, BUS_DMASYNC_PREREAD);
- CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND, FXP_SCB_COMMAND_CU_DUMP_ADR);
+ fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_DUMP_ADR);
cbp = &sc->sc_control_data->fcd_configcb;
memset(cbp, 0, sizeof(struct fxp_cb_config));
@@ -1386,7 +1399,7 @@
*/
fxp_scb_wait(sc);
CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->sc_cddma + FXP_CDCONFIGOFF);
- CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND, FXP_SCB_COMMAND_CU_START);
+ fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
/* ...and wait for it to complete. */
i = 1000;
do {
@@ -1418,7 +1431,7 @@
*/
fxp_scb_wait(sc);
CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->sc_cddma + FXP_CDIASOFF);
- CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND, FXP_SCB_COMMAND_CU_START);
+ fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
/* ...and wait for it to complete. */
i = 1000;
do {
@@ -1480,7 +1493,7 @@
*/
fxp_scb_wait(sc);
CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, FXP_CDTXADDR(sc, sc->sc_txlast));
- CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND, FXP_SCB_COMMAND_CU_START);
+ fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
/*
* Initialize receiver buffer area - RFA.
@@ -1489,7 +1502,7 @@
fxp_scb_wait(sc);
CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL,
rxmap->dm_segs[0].ds_addr + RFA_ALIGNMENT_FUDGE);
- CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND, FXP_SCB_COMMAND_RU_START);
+ fxp_scb_cmd(sc, FXP_SCB_COMMAND_RU_START);
if (sc->sc_flags & FXPF_MII) {
/*
@@ -1640,8 +1653,18 @@
void
fxp_statchg(struct device *self)
{
+ struct fxp_softc *sc = (void *) self;
- /* Nothing to do. */
+ /*
+ * Determine whether or not we have to work-around the
+ * Resume Bug.
+ */
+ if (sc->sc_flags & FXPF_HAS_RESUME_BUG) {
+ if (IFM_TYPE(sc->sc_mii.mii_media_active) == IFM_10_T)
+ sc->sc_flags |= FXPF_FIX_RESUME_BUG;
+ else
+ sc->sc_flags &= ~FXPF_FIX_RESUME_BUG;
+ }
}
void
@@ -1785,7 +1808,7 @@
*/
fxp_scb_wait(sc);
CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->sc_cddma + FXP_CDMCSOFF);
- CSR_WRITE_1(sc, FXP_CSR_SCB_COMMAND, FXP_SCB_COMMAND_CU_START);
+ fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
/* ...and wait for it to complete. */
count = 1000;
diff -r 151f89c34170 -r b2c1cdeef8aa sys/dev/ic/i82557var.h
--- a/sys/dev/ic/i82557var.h Mon May 21 21:39:51 2001 +0000
+++ b/sys/dev/ic/i82557var.h Mon May 21 21:47:52 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i82557var.h,v 1.17 2001/05/21 20:59:39 thorpej Exp $ */
+/* $NetBSD: i82557var.h,v 1.18 2001/05/21 21:47:53 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -195,9 +195,12 @@
int sc_flags; /* misc. flags */
-#define FXPF_WANTINIT 0x01 /* want a re-init */
-#define FXPF_MII 0x02 /* device uses MII */
-#define FXPF_ATTACHED 0x04 /* attach has succeeded */
+#define FXPF_MII 0x01 /* device uses MII */
+#define FXPF_ATTACHED 0x02 /* attach has succeeded */
+#define FXPF_WANTINIT 0x04 /* want a re-init */
+#define FXPF_HAS_RESUME_BUG 0x08 /* has the resume bug */
+#define FXPF_FIX_RESUME_BUG 0x10 /* currently need to work-around
+ the resume bug */
int sc_txpending; /* number of TX requests pending */
int sc_txdirty; /* first dirty TX descriptor */
diff -r 151f89c34170 -r b2c1cdeef8aa sys/dev/pci/if_fxp_pci.c
--- a/sys/dev/pci/if_fxp_pci.c Mon May 21 21:39:51 2001 +0000
+++ b/sys/dev/pci/if_fxp_pci.c Mon May 21 21:47:52 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_fxp_pci.c,v 1.12 2000/12/28 22:59:13 sommerfeld Exp $ */
+/* $NetBSD: if_fxp_pci.c,v 1.13 2001/05/21 21:47:54 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -318,6 +318,13 @@
*/
printf(": %s, rev %d\n", fpp->fpp_name, PCI_REVISION(pa->pa_class));
+ /*
+ * The 82801BA Ethernet has a bug which requires us to send a
+ * NOP before a CU_RESUME if we're in 10baseT mode.
+ */
+ if (fpp->fpp_prodid == PCI_PRODUCT_INTEL_82801BA_LAN)
+ sc->sc_flags |= FXPF_HAS_RESUME_BUG;
+
/* Make sure bus-mastering is enabled. */
pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG) |
Home |
Main Index |
Thread Index |
Old Index