diff -ur pci.orig/dc21040reg.h pci/dc21040reg.h --- pci.orig/dc21040reg.h Mon Aug 30 01:31:30 1999 +++ pci/dc21040reg.h Mon Jan 3 08:43:28 2000 @@ -161,7 +161,7 @@ #define TULIP_STS_RXNOBUF 0x00000080L /* (RW) Receive Buffer Unavailable */ #define TULIP_STS_RXINTR 0x00000040L /* (RW) Receive Interrupt */ #define TULIP_STS_TXUNDERFLOW 0x00000020L /* (RW) Transmit Underflow */ -#define TULIP_STS_LINKPASS 0x00000010L /* (RW) LinkPass (21041) */ +#define TULIP_STS_LINKPASS 0x00000010L /* (RW) LinkPass (21041) or Autonegotiation Completed (21143) */ #define TULIP_STS_TXBABBLE 0x00000008L /* (RW) Transmit Jabber Timeout */ #define TULIP_STS_TXNOBUF 0x00000004L /* (RW) Transmit Buffer Unavailable */ #define TULIP_STS_TXSTOPPED 0x00000002L /* (RW) Transmit Process Stopped */ diff -ur pci.orig/if_de.c pci/if_de.c --- pci.orig/if_de.c Mon Aug 30 01:31:35 1999 +++ pci/if_de.c Mon Jan 3 10:01:44 2000 @@ -170,6 +170,10 @@ #endif #if 0 +#define TULIP_DO_GPR_SENSE +#endif + +#if 1 /* * This turns on all sort of debugging stuff and make the * driver much larger. @@ -177,7 +181,22 @@ #define TULIP_DEBUG #endif -#if 0 +#if 1 +/* + * This turns on very very verbose debugging print. + */ +#define TULIP_DEBUG_VERBOSE 1 +#endif + +#if 1 +/* + * This turns on manual setting media is allways allowed. + * And when media type is MII, write 0x00000000 to CSR13 and CSR14. + */ +#define TULIP_FORCE_MII_MEDIA_SET 1 +#endif + +#if 1 #define TULIP_PERFSTATS #endif @@ -215,6 +234,18 @@ static void tulip_ifmedia_status(struct ifnet * const ifp, struct ifmediareq *req); #endif /* static void tulip_21140_map_media(tulip_softc_t *sc); */ +#ifdef TULIP_DEBUG_VERBOSE +static void tulip_print_flags(tulip_softc_t * const sc); +static void tulip_print_features(tulip_softc_t * const sc); +static void tulip_print_intrmask(tulip_softc_t * const sc); +static void tulip_print_mii_status(u_int32_t status); +static void tulip_print_cmdmode(tulip_softc_t * const sc); +#endif +#ifdef TULIP_DEBUG_VERBOSE +#define TULIP_DEBUG_VERBOSE_PRINTF(x) printf##x +#else +#define TULIP_DEBUG_VERBOSE_PRINTF(x) +#endif static void tulip_timeout_callback( @@ -282,6 +313,9 @@ MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return 0; + + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_txprobe start.\n")); + /* * Construct a LLC TEST message which will point to ourselves. */ @@ -303,6 +337,11 @@ if ((m = tulip_txput(sc, m)) != NULL) m_freem(m); sc->tulip_probe.probe_txprobes++; + + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_txprobe: CSR6:%08x CSR7:%08x\n", + sc->tulip_cmdmode, + sc->tulip_intrmask)); + return 1; } @@ -322,12 +361,22 @@ if (mi == NULL) return; +#ifdef TULIP_DEBUG_VERBOSE + printf("de0: tulip_media_set: setting media to %s.\n", tulip_mediums[media]); + printf("de0: tulip_media_set: current mi->mi_type %d %s.\n", + mi->mi_type, + tulip_mediainfo_string[mi->mi_type]); + printf("de0: tulip_media_set: "); tulip_print_features(sc); + printf("de0: tulip_media_set: "); tulip_print_flags(sc); +#endif + /* * If we are switching media, make sure we don't think there's * any stale RX activity */ sc->tulip_flags &= ~TULIP_RXACT; if (mi->mi_type == TULIP_MEDIAINFO_SIA) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: mi->mi_type == TULIP_MEDIAINFO_SIA\n")); TULIP_CSR_WRITE(sc, csr_sia_connectivity, TULIP_SIACONN_RESET); TULIP_CSR_WRITE(sc, csr_sia_tx_rx, mi->mi_sia_tx_rx); if (sc->tulip_features & TULIP_HAVE_SIAGP) { @@ -340,6 +389,7 @@ TULIP_CSR_WRITE(sc, csr_sia_connectivity, mi->mi_sia_connectivity); } else if (mi->mi_type == TULIP_MEDIAINFO_GPR) { #define TULIP_GPR_CMDBITS (TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION|TULIP_CMD_SCRAMBLER|TULIP_CMD_TXTHRSHLDCTL) + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: mi->mi_type == TULIP_MEDIAINFO_GPR\n")); /* * If the cmdmode bits don't match the currently operating mode, * set the cmdmode appropriately and reset the chip. @@ -353,6 +403,7 @@ DELAY(10); TULIP_CSR_WRITE(sc, csr_gp, (u_int8_t) mi->mi_gpdata); } else if (mi->mi_type == TULIP_MEDIAINFO_SYM) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: mi->mi_type == TULIP_MEDIAINFO_SYM\n")); /* * If the cmdmode bits don't match the currently operating mode, * set the cmdmode appropriately and reset the chip. @@ -364,46 +415,86 @@ } TULIP_CSR_WRITE(sc, csr_sia_general, mi->mi_gpcontrol); TULIP_CSR_WRITE(sc, csr_sia_general, mi->mi_gpdata); - } else if (mi->mi_type == TULIP_MEDIAINFO_MII - && sc->tulip_probe_state != TULIP_PROBE_INACTIVE) { - int idx; - if (sc->tulip_features & TULIP_HAVE_SIAGP) { - const u_int8_t *dp; - dp = &sc->tulip_rombuf[mi->mi_reset_offset]; - for (idx = 0; idx < mi->mi_reset_length; idx++, dp += 2) { - DELAY(10); - TULIP_CSR_WRITE(sc, csr_sia_general, (dp[0] + 256 * dp[1]) << 16); - } - sc->tulip_phyaddr = mi->mi_phyaddr; - dp = &sc->tulip_rombuf[mi->mi_gpr_offset]; - for (idx = 0; idx < mi->mi_gpr_length; idx++, dp += 2) { - DELAY(10); - TULIP_CSR_WRITE(sc, csr_sia_general, (dp[0] + 256 * dp[1]) << 16); - } - } else { - for (idx = 0; idx < mi->mi_reset_length; idx++) { - DELAY(10); - TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_rombuf[mi->mi_reset_offset + idx]); - } - sc->tulip_phyaddr = mi->mi_phyaddr; - for (idx = 0; idx < mi->mi_gpr_length; idx++) { - DELAY(10); - TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_rombuf[mi->mi_gpr_offset + idx]); - } - } - if (sc->tulip_flags & TULIP_TRYNWAY) { - tulip_mii_autonegotiate(sc, sc->tulip_phyaddr); - } else if ((sc->tulip_flags & TULIP_DIDNWAY) == 0) { - u_int32_t data = tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_CONTROL); - data &= ~(PHYCTL_SELECT_100MB|PHYCTL_FULL_DUPLEX|PHYCTL_AUTONEG_ENABLE); - sc->tulip_flags &= ~TULIP_DIDNWAY; - if (TULIP_IS_MEDIA_FD(media)) - data |= PHYCTL_FULL_DUPLEX; - if (TULIP_IS_MEDIA_100MB(media)) - data |= PHYCTL_SELECT_100MB; - tulip_mii_writereg(sc, sc->tulip_phyaddr, PHYREG_CONTROL, data); - } + } else if (mi->mi_type == TULIP_MEDIAINFO_MII ) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: mi->mi_type == TULIP_MEDIAINFO_MII\n")); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: sc->tulip_probe_state = %d %s\n", + sc->tulip_probe_state, + tulip_probe_state_str[sc->tulip_probe_state])); + +#ifdef TULIP_FORCE_MII_MEDIA_SET + if (1) { +#else + if ( sc->tulip_probe_state != TULIP_PROBE_INACTIVE) { +#endif + int idx; + if (sc->tulip_features & TULIP_HAVE_SIAGP) { + const u_int8_t *dp; + dp = &sc->tulip_rombuf[mi->mi_reset_offset]; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: tulip_features has TULIP_HAVE_SIAGP.\n")); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: mi->mi_reset_length = %d\n", mi->mi_reset_length)); + for (idx = 0; idx < mi->mi_reset_length; idx++, dp += 2) { + DELAY(60); + TULIP_CSR_WRITE(sc, csr_sia_general, (dp[0] + 256 * dp[1]) << 16); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: TULIP_CSR_WRITE(CSR15, %08x)\n", (dp[0] + 256 * dp[1]) << 16)); + } + sc->tulip_phyaddr = mi->mi_phyaddr; + dp = &sc->tulip_rombuf[mi->mi_gpr_offset]; + for (idx = 0; idx < mi->mi_gpr_length; idx++, dp += 2) { + DELAY(10); + TULIP_CSR_WRITE(sc, csr_sia_general, (dp[0] + 256 * dp[1]) << 16); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: TULIP_CSR_WRITE(CSR15, %08x)\n", (dp[0] + 256 * dp[1]) << 16)); + } +#ifdef TULIP_FORCE_MII_MEDIA_SET + if ( mi->mi_reset_length == 0 && mi->mi_gpr_length == 0 ) { + DELAY(50); + TULIP_CSR_WRITE(sc, csr_sia_general, 0); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: TULIP_CSR_WRITE(CSR15, %08x)\n", 0 )); + DELAY(50); + TULIP_CSR_WRITE(sc, csr_sia_tx_rx, 0); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: TULIP_CSR_WRITE(CSR14, %08x)\n", 0 )); + DELAY(50); + TULIP_CSR_WRITE(sc, csr_sia_connectivity, 0); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: TULIP_CSR_WRITE(CSR13, %08x)\n", 0 )); + } +#endif /* TULIP_FORCE_MII_MEDIA_SET */ + } else { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: tulip_features has not TULIP_HAVE_SIAGP.\n")); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: mi->mi_reset_length = %d\n", mi->mi_reset_length)); + for (idx = 0; idx < mi->mi_reset_length; idx++) { + DELAY(50); + TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_rombuf[mi->mi_reset_offset + idx]); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: TULIP_CSR_WRITE(CSR12, %08x)\n", sc->tulip_rombuf[mi->mi_reset_offset + idx])); + } + sc->tulip_phyaddr = mi->mi_phyaddr; + for (idx = 0; idx < mi->mi_gpr_length; idx++) { + DELAY(10); + TULIP_CSR_WRITE(sc, csr_gp, sc->tulip_rombuf[mi->mi_gpr_offset + idx]); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: TULIP_CSR_WRITE(CSR12, %08x)\n", sc->tulip_rombuf[mi->mi_gpr_offset + idx])); + } + } + if (sc->tulip_flags & TULIP_TRYNWAY) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: tulip_flags & TULIP_TRYNWAY is true.\n")); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: now try to auto negotiate.\n")); + tulip_mii_autonegotiate(sc, sc->tulip_phyaddr); + } else if ((sc->tulip_flags & TULIP_DIDNWAY) == 0) { + u_int32_t data = tulip_mii_readreg(sc, sc->tulip_phyaddr, PHYREG_CONTROL); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: auto negotiation is done?\n")); + data &= ~(PHYCTL_SELECT_100MB|PHYCTL_FULL_DUPLEX|PHYCTL_AUTONEG_ENABLE); + sc->tulip_flags &= ~TULIP_DIDNWAY; + if (TULIP_IS_MEDIA_FD(media)) { + data |= PHYCTL_FULL_DUPLEX; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: set full duplex flag.\n")); + } + if (TULIP_IS_MEDIA_100MB(media)) { + data |= PHYCTL_SELECT_100MB; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: set 100MB flag.\n")); + } + tulip_mii_writereg(sc, sc->tulip_phyaddr, PHYREG_CONTROL, data); + } + } } + + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_set: return function.\n")); } static void @@ -411,6 +502,8 @@ tulip_softc_t * const sc, tulip_media_t media) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_linkup: enter function.\n")); + if ((sc->tulip_flags & TULIP_LINKUP) == 0) sc->tulip_flags |= TULIP_PRINTLINKUP; sc->tulip_flags |= TULIP_LINKUP; @@ -429,14 +522,17 @@ } #endif if (sc->tulip_media != media) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_linkup: changing media...\n")); #ifdef TULIP_DEBUG sc->tulip_dbg.dbg_last_media = sc->tulip_media; #endif sc->tulip_media = media; sc->tulip_flags |= TULIP_PRINTMEDIA; if (TULIP_IS_MEDIA_FD(sc->tulip_media)) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_linkup: add full duplex flag.\n")); sc->tulip_cmdmode |= TULIP_CMD_FULLDUPLEX; } else if (sc->tulip_chipid != TULIP_21041 || (sc->tulip_flags & TULIP_DIDNWAY) == 0) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_linkup: mask full duplex flag.\n")); sc->tulip_cmdmode &= ~TULIP_CMD_FULLDUPLEX; } } @@ -451,12 +547,21 @@ sc->tulip_flags &= ~(TULIP_TXPROBE_ACTIVE|TULIP_TRYNWAY); if (sc->tulip_flags & TULIP_INRESET) { tulip_media_set(sc, sc->tulip_media); - } else if (sc->tulip_probe_media != sc->tulip_media) { + } + /* + * Condition check was removed. When probed media with + * autonegotiation is not correct, I want to setup media type with + * ifconfig command manually. + */ +#ifndef TULIP_FORCE_MII_MEDIA_SET + else if (sc->tulip_probe_media != sc->tulip_media) { /* * No reason to change media if we have the right media. */ + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_linkup: No reason to change media if we have the right media. I will not change media.\n")); tulip_reset(sc); } +#endif /* TULIP_FORCE_MI_MEDIA_SET */ tulip_init(sc); } @@ -663,6 +768,10 @@ /* * Link Monitor failed. Probe for new media. */ + + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: event == TULIP_PROBE_INACTIVE.\n")); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: TULIP_LINK_DOWN.\n")); + event = TULIP_MEDIAPOLL_LINKFAIL; break; } @@ -677,12 +786,15 @@ /* * We can't tell so don't bother. */ + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: event == TULIP_PROBE_INACTIVE.\n")); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: TULIP_LINK_UNKDOWN.\n")); return; } } } if (event == TULIP_MEDIAPOLL_LINKFAIL) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: event == TULIP_MEDIAPOLL_LINKFAIL.\n")); if (sc->tulip_probe_state == TULIP_PROBE_INACTIVE) { if (TULIP_DO_AUTOSENSE(sc)) { #if defined(TULIP_DEBUG) @@ -700,6 +812,7 @@ } if (event == TULIP_MEDIAPOLL_START) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: event == TULIP_MEDIAPOLL_START.\n")); sc->tulip_if.if_flags |= IFF_OACTIVE; if (sc->tulip_probe_state != TULIP_PROBE_INACTIVE) return; @@ -739,6 +852,7 @@ */ if (event == TULIP_MEDIAPOLL_TXPROBE_FAILED && sc->tulip_probe_state != TULIP_PROBE_MEDIATEST) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: event == TULIP_MEDIAPOLL_TXPROBE_FAILED.\n")); sc->tulip_flags &= ~TULIP_TXPROBE_ACTIVE; return; } @@ -747,6 +861,7 @@ * If we really transmitted a packet, then that's the media we'll use. */ if (event == TULIP_MEDIAPOLL_TXPROBE_OK || event == TULIP_MEDIAPOLL_LINKPASS) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: event == TULIP_MEDIAPOLL_TXPROBE_OK or TULIP_MEDIAPOLL_LINKPASS.\n")); if (event == TULIP_MEDIAPOLL_LINKPASS) { /* XXX Check media status just to be sure */ sc->tulip_probe_media = TULIP_MEDIA_10BASET; @@ -761,6 +876,7 @@ } if (sc->tulip_probe_state == TULIP_PROBE_GPRTEST) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: event == TULIP_MEDIAPOLL_GRPTEST.\n")); #if defined(TULIP_DO_GPR_SENSE) /* * Check for media via the general purpose register. @@ -801,13 +917,20 @@ if (sc->tulip_probe_state != TULIP_PROBE_MEDIATEST && (sc->tulip_features & TULIP_HAVE_MII)) { tulip_media_t old_media = sc->tulip_probe_media; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: event != TULIP_PROBE_MEDIATEST.\n")); tulip_mii_autonegotiate(sc, sc->tulip_phyaddr); + + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: after call tulip_mii_autonegotiate, sc->tulip_probe_state is %d %s\n", + sc->tulip_probe_state, + tulip_probe_state_str[sc->tulip_probe_state])); + switch (sc->tulip_probe_state) { case TULIP_PROBE_FAILED: case TULIP_PROBE_MEDIATEST: { /* * Try the next media. */ + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: Humm. probe failed. try next media.\n")); sc->tulip_probe_mediamask |= sc->tulip_mediums[sc->tulip_probe_media]->mi_mediamask; sc->tulip_probe_timeout = 0; #ifdef notyet @@ -845,6 +968,7 @@ } if (event == TULIP_MEDIAPOLL_TXPROBE_FAILED) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: event == TULIP_MEDIAPOLL_TXPROBE_FAILED.\n")); #if defined(TULIP_DEBUG) sc->tulip_dbg.dbg_txprobes_failed[sc->tulip_probe_media]++; #endif @@ -856,6 +980,7 @@ * switch to another media if we tried this one enough. */ if (/* event == TULIP_MEDIAPOLL_TXPROBE_FAILED || */ sc->tulip_probe_timeout <= 0) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: tulip_probe_timeout <= 0.... try next.\n")); #if defined(TULIP_DEBUG) if (sc->tulip_probe_media == TULIP_MEDIA_UNKNOWN) { printf(TULIP_PRINTF_FMT ": poll media unknown!\n", @@ -883,6 +1008,7 @@ sc->tulip_probe_mediamask = 0; sc->tulip_probe_media = TULIP_MEDIA_MAX - 1; } + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_media_poll: probing media %s.\n", tulip_mediums[sc->tulip_probe_media])); } while (sc->tulip_mediums[sc->tulip_probe_media] == NULL || (sc->tulip_probe_mediamask & TULIP_BIT(sc->tulip_probe_media)) || TULIP_IS_MEDIA_FD(sc->tulip_probe_media)); @@ -1387,22 +1513,31 @@ tulip_softc_t * const sc, unsigned abilities) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_mii_map_abilities: enter function. abilities = %08x\n", + abilities)); sc->tulip_abilities = abilities; if (abilities & PHYSTS_100BASETX_FD) { sc->tulip_probe_media = TULIP_MEDIA_100BASETX_FD; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_mii_map_abilities: sc->tulip_probe_media is set to TULIP_MEDIA_100BASETX_FD\n")); } else if (abilities & PHYSTS_100BASET4) { sc->tulip_probe_media = TULIP_MEDIA_100BASET4; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_mii_map_abilities: sc->tulip_probe_media is set to TULIP_MEDIA_100BASET4\n")); } else if (abilities & PHYSTS_100BASETX) { sc->tulip_probe_media = TULIP_MEDIA_100BASETX; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_mii_map_abilities: sc->tulip_probe_media is set to TULIP_MEDIA_100BASETX\n")); } else if (abilities & PHYSTS_10BASET_FD) { sc->tulip_probe_media = TULIP_MEDIA_10BASET_FD; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_mii_map_abilities: sc->tulip_probe_media is set to TULIP_MEDIA_10BASET_FD\n")); } else if (abilities & PHYSTS_10BASET) { sc->tulip_probe_media = TULIP_MEDIA_10BASET; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_mii_map_abilities: sc->tulip_probe_media is set to TULIP_MEDIA_10BASET\n")); } else { sc->tulip_probe_state = TULIP_PROBE_MEDIATEST; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_mii_map_abilities: uummm. probe failed? sc->tulip_probe_state is set to TULIP_PROBE_MEDIATEST.\n")); return 0; } sc->tulip_probe_state = TULIP_PROBE_INACTIVE; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_mii_map_abilities: abilities is set. now sc->tulip_probe_state is set to TULIP_PROBE_INACTIVE.\n")); return 1; } @@ -1411,6 +1546,11 @@ tulip_softc_t * const sc, const unsigned phyaddr) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_mii_autonegotiate: enter function.\n")); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_mii_autonegotiate: sc->tulip_probe_state = %d %s\n", + sc->tulip_probe_state, + tulip_probe_state_str[sc->tulip_probe_state])); + switch (sc->tulip_probe_state) { case TULIP_PROBE_MEDIATEST: case TULIP_PROBE_INACTIVE: { @@ -1424,6 +1564,7 @@ case TULIP_PROBE_PHYRESET: { u_int32_t status; u_int32_t data = tulip_mii_readreg(sc, phyaddr, PHYREG_CONTROL); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_mii_autonegotiate: PROBE_PHYRESET\n")); if (data & PHYCTL_RESET) { if (sc->tulip_probe_timeout > 0) { tulip_timeout(sc); @@ -1466,6 +1607,11 @@ case TULIP_PROBE_PHYAUTONEG: { u_int32_t status = tulip_mii_readreg(sc, phyaddr, PHYREG_STATUS); u_int32_t data; +#ifdef TULIP_DEBUG_VERBOSE + printf("de0: tulip_mii_autonegotiate: PROBE_PHYAUTONEG\n"); + printf("de0: tulip_mii_autonegotiate: ") ; tulip_print_mii_status(status); + printf("de0: tulip_mii_autonegotiate: ") ; tulip_print_intrmask(sc); +#endif if ((status & PHYSTS_AUTONEG_DONE) == 0) { if (sc->tulip_probe_timeout > 0) { tulip_timeout(sc); @@ -1476,6 +1622,7 @@ TULIP_PRINTF_ARGS, phyaddr, status, tulip_mii_readreg(sc, phyaddr, PHYREG_CONTROL)); #endif + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_mii_autonegotiate: autonegotiation timeout\n")); sc->tulip_flags &= ~TULIP_DIDNWAY; sc->tulip_probe_state = TULIP_PROBE_MEDIATEST; return; @@ -1485,7 +1632,9 @@ loudprintf(TULIP_PRINTF_FMT "(phy%d): autonegotiation complete: 0x%04x\n", TULIP_PRINTF_ARGS, phyaddr, data); #endif + TULIP_DEBUG_VERBOSE_PRINTF(("de0: autonegotiation compelete!!! data:%08x\n", data)); data = (data << 6) & status; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: autonegotiation compelete. calced data:%08x\n", data)); if (!tulip_mii_map_abilities(sc, data)) sc->tulip_flags &= ~TULIP_DIDNWAY; return; @@ -2083,9 +2232,14 @@ } #define tulip_mchash(mca) (tulip_crc32(mca, 6) & 0x1FF) -#define tulip_srom_crcok(databuf) ( \ +#define tulip_srom_crcok(databuf) \ + (tulip_srom_crcok128(databuf) || tulip_srom_crcok96(databuf)) +#define tulip_srom_crcok128(databuf) ( \ ((tulip_crc32(databuf, 126) & 0xFFFFU) ^ 0xFFFFU) == \ ((databuf)[126] | ((databuf)[127] << 8))) +#define tulip_srom_crcok96(databuf) ( \ + ((tulip_crc32(databuf, 94) & 0xFFFFU) ^ 0xFFFFU) == \ + ((databuf)[94] | ((databuf)[95] << 8))) static unsigned tulip_crc32( @@ -2401,6 +2555,8 @@ const u_int8_t *dp; u_int32_t leaf_offset, blocks, data; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_srom_decode: enter function.\n")); + for (idx1 = 0; idx1 < shp->sh_adapter_count; idx1++, saip++) { if (shp->sh_adapter_count == 1) break; @@ -2437,6 +2593,8 @@ } sc->tulip_connidx = idx2; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_srom_decode: sc->tulip_chipid = %d\n", sc->tulip_chipid)); + if (sc->tulip_chipid == TULIP_21041) { blocks = *dp++; for (idx2 = 0; idx2 < blocks; idx2++) { @@ -2511,6 +2669,9 @@ type = *dp++ & 0x3f; } ep = dp + length; + + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_srom_decode: srom type is %d\n", type)); + switch (type & 0x3f) { case 0: { /* 21140[A] GPR block */ tulip_media_t media; @@ -2603,6 +2764,9 @@ } case 2: { /* 2114[23] SIA block */ tulip_media_t media; + + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_srom_decode: 2114[23] SIA block.\n")); + srom_media = (tulip_srom_media_t)(dp[0] & 0x3f); for (idx3 = 0; tulip_srom_mediums[idx3].sm_type != TULIP_MEDIA_UNKNOWN; idx3++) { if (tulip_srom_mediums[idx3].sm_srom_type == srom_media) @@ -2652,6 +2816,9 @@ case 3: { /* 2114[23] MII PHY block */ const unsigned phyno = *dp++; const u_int8_t *dp0; + + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_srom_decode: 2114[23] MII PHY block.\n")); + mi->mi_type = TULIP_MEDIAINFO_MII; mi->mi_gpr_length = *dp++; mi->mi_gpr_offset = dp - sc->tulip_rombuf; @@ -2664,16 +2831,20 @@ for (idx3 = 0; idx3 < mi->mi_reset_length; idx3++, dp0 += 2) { DELAY(10); TULIP_CSR_WRITE(sc, csr_sia_general, (dp0[0] + 256 * dp0[1]) << 16); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_srom_decode: TULIP_CSR_WRITE(CSR15, %08x)\n", (dp0[0] + 256 * dp0[1]) << 16 )); } sc->tulip_phyaddr = mi->mi_phyaddr; dp0 = &sc->tulip_rombuf[mi->mi_gpr_offset]; for (idx3 = 0; idx3 < mi->mi_gpr_length; idx3++, dp0 += 2) { DELAY(10); TULIP_CSR_WRITE(sc, csr_sia_general, (dp0[0] + 256 * dp0[1]) << 16); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_srom_decode: TULIP_CSR_WRITE(CSR15, %08x)\n", (dp0[0] + 256 * dp0[1]) << 16 )); } - if (mi->mi_reset_length == 0 && mi->mi_gpr_length == 0) + if (mi->mi_reset_length == 0 && mi->mi_gpr_length == 0) { TULIP_CSR_WRITE(sc, csr_sia_general, 0); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_srom_decode: TULIP_CSR_WRITE(CSR15, %08x)\n", 0 )); + } mi->mi_phyaddr = TULIP_MII_NOPHY; for (idx3 = 20; idx3 > 0 && mi->mi_phyaddr == TULIP_MII_NOPHY; idx3--) { @@ -2705,6 +2876,9 @@ } case 4: { /* 21143 SYM block */ tulip_media_t media; + + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_srom_decode: 21143 SYM block.\n")); + srom_media = (tulip_srom_media_t) dp[0]; for (idx3 = 0; tulip_srom_mediums[idx3].sm_type != TULIP_MEDIA_UNKNOWN; idx3++) { if (tulip_srom_mediums[idx3].sm_srom_type == srom_media) @@ -2733,6 +2907,8 @@ } #if 0 case 5: { /* 21143 Reset block */ + + mi->mi_type = TULIP_MEDIAINFO_RESET; mi->mi_reset_length = *dp++; mi->mi_reset_offset = dp - sc->tulip_rombuf; @@ -2742,6 +2918,7 @@ } #endif default: { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_srom_decode: unknown block.\n")); } } dp = ep; @@ -2779,6 +2956,8 @@ unsigned char tmpbuf[8]; static const u_char testpat[] = { 0xFF, 0, 0x55, 0xAA, 0xFF, 0, 0x55, 0xAA }; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_read_macaddr: enter func.\n")); + sc->tulip_connidx = TULIP_SROM_LASTCONNIDX; if (sc->tulip_chipid == TULIP_21040) { @@ -2976,8 +3155,16 @@ * Check for various boards based on OUI. Did I say braindead? */ for (idx = 0; tulip_vendors[idx].vendor_identify_nic != NULL; idx++) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_read_macaddr: searching the vendor_oui %02x %02x %02x\n", + tulip_vendors[idx].vendor_oui[0], + tulip_vendors[idx].vendor_oui[1], + tulip_vendors[idx].vendor_oui[2])); if (bcmp((caddr_t) sc->tulip_enaddr, (caddr_t) tulip_vendors[idx].vendor_oui, 3) == 0) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_read_macaddr: hit the vendor_oui %02x %02x %02x\n", + tulip_vendors[idx].vendor_oui[0], + tulip_vendors[idx].vendor_oui[1], + tulip_vendors[idx].vendor_oui[2])); (*tulip_vendors[idx].vendor_identify_nic)(sc); break; } @@ -3022,11 +3209,14 @@ { tulip_softc_t * const sc = TULIP_IFP_TO_SOFTC(ifp); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_ifmedia_change: enter function\n")); + sc->tulip_flags |= TULIP_NEEDRESET; sc->tulip_probe_state = TULIP_PROBE_INACTIVE; sc->tulip_media = TULIP_MEDIA_UNKNOWN; if (IFM_SUBTYPE(sc->tulip_ifmedia.ifm_media) != IFM_AUTO) { tulip_media_t media; + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_ifmedia_change: IFM_SUBTYPE(sc->tulip_ifmedia.ifm_media) != IFM_AUTO\n")); for (media = TULIP_MEDIA_UNKNOWN; media < TULIP_MEDIA_MAX; media++) { if (sc->tulip_mediums[media] != NULL && sc->tulip_ifmedia.ifm_media == tulip_media_to_ifmedia[media]) { @@ -3037,6 +3227,7 @@ } } } + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_ifmedia_change: IFM_SUBTYPE(sc->tulip_ifmedia.ifm_media) == IFM_AUTO\n")); sc->tulip_flags &= ~(TULIP_TXPROBE_ACTIVE|TULIP_WANTRXACT); tulip_reset(sc); tulip_init(sc); @@ -3232,6 +3423,8 @@ tulip_desc_t *di; u_int32_t inreset = (sc->tulip_flags & TULIP_INRESET); + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_reset: enter function\n")); + /* * Brilliant. Simply brilliant. When switching modes/speeds * on a 2114*, you need to set the appriopriate MII/PCS/SCL/PS @@ -3370,6 +3563,8 @@ tulip_init( tulip_softc_t * const sc) { + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_init: enter function.\n")); + if (sc->tulip_if.if_flags & IFF_UP) { if ((sc->tulip_if.if_flags & IFF_RUNNING) == 0) { /* initialize the media */ @@ -3401,6 +3596,12 @@ } TULIP_CSR_WRITE(sc, csr_intr, sc->tulip_intrmask); TULIP_CSR_WRITE(sc, csr_command, sc->tulip_cmdmode); +#ifdef TULIP_DEBUG_VERBOSE + printf("de0: tulip_init: set CSR7:%08x CSR6:%08x\n", + sc->tulip_intrmask, + sc->tulip_cmdmode); + printf("de0: tulip_init: "); tulip_print_intrmask(sc); +#endif if ((sc->tulip_flags & (TULIP_WANTSETUP|TULIP_TXPROBE_ACTIVE)) == TULIP_WANTSETUP) tulip_txput_setup(sc); } else { @@ -3967,6 +4168,7 @@ #if defined(TULIP_DEBUG) sc->tulip_dbg.dbg_link_intrs++; #endif + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_intr_handler: TULIP_STS_LINKPASS or TULIP_STS_LINKFAIL\n")); if (sc->tulip_boardsw->bd_media_poll != NULL) { (*sc->tulip_boardsw->bd_media_poll)(sc, csr & TULIP_STS_LINKFAIL ? TULIP_MEDIAPOLL_LINKFAIL @@ -4030,6 +4232,15 @@ tulip_ifstart(&sc->tulip_if); } } +#ifdef TULIP_DEBUG_VERBOSE + if (csr & TULIP_STS_LINKPASS) { + if ( (csr & TULIP_STS_LINKPASS) & sc->tulip_intrmask ) { + printf("de0: tulip_intr_handler: receive TULIP_STS_LINKPASS.\n"); + } else { + printf("de0: tulip_intr_handler: receive TULIP_STS_LINKPASS but ignored because tulip_intrmask.\n"); + } + } +#endif if (sc->tulip_flags & TULIP_NEEDRESET) { tulip_reset(sc); tulip_init(sc); @@ -4580,7 +4791,9 @@ { tulip_ringinfo_t * const ri = &sc->tulip_txinfo; tulip_desc_t *nextout; - + + TULIP_DEBUG_VERBOSE_PRINTF(("de0: tulip_txput_setup: enter function.\n")); + /* * We will transmit, at most, one setup packet per call to ifstart. */ @@ -5917,3 +6130,230 @@ TULIP_RESTORESPL(s); } } + +#ifdef TULIP_DEBUG_VERBOSE +static struct tulip_flags_string_tbl_tag +{ + char *name; + u_int32_t mask; +} tulip_flags_string_tbl[] = { + {"TULIP_WANTSETUP", 0x00000001}, + {"TULIP_WANTHASHPERFECT", 0x00000002}, + {"TULIP_WANTHASHONLY", 0x00000004}, + {"TULIP_DOINGSETUP", 0x00000008}, + {"TULIP_PRINTMEDIA", 0x00000010}, + {"TULIP_TXPROBE_ACTIVE", 0x00000020}, + {"TULIP_ALLMULTI", 0x00000040}, + {"TULIP_WANTRXACT", 0x00000080}, + {"TULIP_RXACT", 0x00000100}, + {"TULIP_INRESET", 0x00000200}, + {"TULIP_NEEDRESET", 0x00000400}, + {"TULIP_SQETEST", 0x00000800}, + {"TULIP_xxxxxx0", 0x00001000}, + {"TULIP_xxxxxx1", 0x00002000}, + {"TULIP_WANTTXSTART", 0x00004000}, + {"TULIP_NEWTXTHRESH", 0x00008000}, + {"TULIP_NOAUTOSENSE", 0x00010000}, + {"TULIP_PRINTLINKUP", 0x00020000}, + {"TULIP_LINKUP", 0x00040000}, + {"TULIP_RXBUFSLOW", 0x00080000}, + {"TULIP_NOMESSAGES", 0x00100000}, + {"TULIP_SYSTEMERROR", 0x00200000}, + {"TULIP_TIMEOUTPENDING", 0x00400000}, + {"TULIP_xxxxxx2", 0x00800000}, + {"TULIP_TRYNWAY", 0x01000000}, + {"TULIP_DIDNWAY", 0x02000000}, + {"TULIP_RXIGNORE", 0x04000000}, + {"TULIP_PROBE1STPASS", 0x08000000}, + {"TULIP_DEVICEPROBE", 0x10000000}, + {"TULIP_PROMISC", 0x20000000}, + {"TULIP_HASHONLY", 0x40000000}, + {"TULIP_xxxxxx3", 0x80000000}, + {NULL, NULL} +}; +static void +tulip_print_flags(tulip_softc_t * const sc) +{ + int i; + + printf("sc->tulip_flags is"); + for ( i = 0 ; tulip_flags_string_tbl[i].name != NULL ; i++ ) { + if ( sc->tulip_flags & tulip_flags_string_tbl[i].mask ) { + printf(" %s", tulip_flags_string_tbl[i].name); + } + } + printf("\n"); +} + +#endif /* TULIP_DEBUG_VERBOSE */ + +#ifdef TULIP_DEBUG_VERBOSE +static struct tulip_features_string_tbl_tag +{ + char *name; + u_int32_t mask; +} tulip_features_string_tbl[] = { + {"TULIP_HAVE_GPR", 0x00000001}, /* have gp register (140[A]) */ + {"TULIP_HAVE_RXBADOVRFLW", 0x00000002}, /* RX corrupts on overflow */ + {"TULIP_HAVE_POWERMGMT", 0x00000004}, /* Snooze/sleep modes */ + {"TULIP_HAVE_MII", 0x00000008}, /* Some medium on MII */ + {"TULIP_HAVE_SIANWAY", 0x00000010}, /* SIA does NWAY */ + {"TULIP_HAVE_DUALSENSE", 0x00000020}, /* SIA senses both AUI & TP */ + {"TULIP_HAVE_SIAGP", 0x00000040}, /* SIA has a GP port */ + {"TULIP_HAVE_BROKEN_HASH", 0x00000080}, /* Broken Multicast Hash */ + {"TULIP_HAVE_ISVSROM", 0x00000100}, /* uses ISV SROM Format */ + {"TULIP_HAVE_BASEROM", 0x00000200}, /* Board ROM can be cloned */ + {"TULIP_HAVE_SLAVEDROM", 0x00000400}, /* Board ROM cloned */ + {"TULIP_HAVE_SLAVEDINTR", 0x00000800}, /* Board slaved interrupt */ + {"TULIP_HAVE_SHAREDINTR", 0x00001000}, /* Board shares interrupts */ + {"TULIP_HAVE_OKROM", 0x00002000}, /* ROM was recognized */ + {"TULIP_HAVE_NOMEDIA", 0x00004000}, /* did not detect any media */ + {"TULIP_HAVE_STOREFWD", 0x00008000}, /* have CMD_STOREFWD */ + {"TULIP_HAVE_SIA100", 0x00010000}, /* has LS100 in SIA status */ + {"TULIP_HAVE_OKSROM", 0x00020000}, /* SROM CRC is OK */ + {NULL, NULL} +}; +static void +tulip_print_features(tulip_softc_t * const sc) +{ + int i; + + printf("sc->tulip_features is"); + for ( i = 0 ; tulip_features_string_tbl[i].name != NULL ; i++ ) { + if ( sc->tulip_features & tulip_features_string_tbl[i].mask ) { + printf(" %s", tulip_features_string_tbl[i].name); + } + } + printf("\n"); +} + +#endif /* TULIP_DEBUG_VERBOSE */ + +#ifdef TULIP_DEBUG_VERBOSE +/* + * to display intruppt flag + */ +struct tulip_intrmask_str_tbl_tag +{ + char *name; + int mask; +} tulip_intrmask_str_tbl[] = { + {"TULIP_STS_NORMALINTR", TULIP_STS_NORMALINTR}, + {"TULIP_STS_ABNRMLINTR", TULIP_STS_ABNRMLINTR}, + {"TULIP_STS_SYSERROR", TULIP_STS_SYSERROR}, + {"TULIP_STS_LINKFAIL", TULIP_STS_LINKFAIL}, + {"TULIP_STS_FULDPLXSHRT", TULIP_STS_FULDPLXSHRT}, + {"TULIP_STS_GPTIMEOUT", TULIP_STS_GPTIMEOUT}, + {"TULIP_STS_AUI", TULIP_STS_AUI}, + {"TULIP_STS_RXTIMEOUT", TULIP_STS_RXTIMEOUT}, + {"TULIP_STS_RXSTOPPED", TULIP_STS_RXSTOPPED}, + {"TULIP_STS_RXNOBUF", TULIP_STS_RXNOBUF}, + {"TULIP_STS_RXINTR", TULIP_STS_RXINTR}, + {"TULIP_STS_TXUNDERFLOW", TULIP_STS_TXUNDERFLOW}, + {"TULIP_STS_LINKPASS", TULIP_STS_LINKPASS}, + {"TULIP_STS_TXBABBLE", TULIP_STS_TXBABBLE}, + {"TULIP_STS_TXNOBUF", TULIP_STS_TXNOBUF}, + {"TULIP_STS_TXSTOPPED", TULIP_STS_TXSTOPPED}, + {"TULIP_STS_TXINTR", TULIP_STS_TXINTR}, + {NULL, NULL} + +}; +static void tulip_print_intrmask(tulip_softc_t * const sc) +{ + int i; + + printf("sc->tulip_intrmask is"); + for ( i = 0 ; tulip_intrmask_str_tbl[i].name != NULL ; i++ ) { + if ( sc->tulip_intrmask & tulip_intrmask_str_tbl[i].mask ) { + printf(" %s", tulip_intrmask_str_tbl[i].name); + } + } + printf("\n"); +} +#endif + +#ifdef TULIP_DEBUG_VERBOSE +struct tulip_mii_status_str_tbl_tag { + char *name; + int mask; +} tulip_mii_status_str_tbl[] = { + {"PHYSTS_100BASET4", PHYSTS_100BASET4}, + {"PHYSTS_100BASETX_FD", PHYSTS_100BASETX_FD}, + {"PHYSTS_100BASETX", PHYSTS_100BASETX}, + {"PHYSTS_10BASET_FD", PHYSTS_10BASET_FD}, + {"PHYSTS_10BASET", PHYSTS_10BASET}, + {"PHYSTS_AUTONEG_DONE", PHYSTS_AUTONEG_DONE}, + {"PHYSTS_REMOTE_FAULT", PHYSTS_REMOTE_FAULT}, + {"PHYSTS_CAN_AUTONEG", PHYSTS_CAN_AUTONEG}, + {"PHYSTS_LINK_UP", PHYSTS_LINK_UP}, + {"PHYSTS_JABBER_DETECT", PHYSTS_JABBER_DETECT}, + {"PHYSTS_EXTENDED_REGS", PHYSTS_EXTENDED_REGS}, + {NULL, NULL} +}; +static void tulip_print_mii_status(u_int32_t status) { + int i; + + printf("mii status is "); + for ( i = 0 ; tulip_mii_status_str_tbl[i].name != NULL ; i++ ) { + if ( status & tulip_mii_status_str_tbl[i].mask ) { + printf(" %s", tulip_mii_status_str_tbl[i].name); + } + } + printf("\n"); +} +#endif + +#ifdef TULIP_DEBUG_VERBOSE +struct tulip_cmdmode_str_tbl_tag +{ + char *name; + int mask; +} tulip_cmdmode_str_tbl[] = { + {"TULIP_CMD_MUSTBEONE", TULIP_CMD_MUSTBEONE}, + {"TULIP_CMD_SCRAMBLER", TULIP_CMD_SCRAMBLER}, + {"TULIP_CMD_PCSFUNCTION", TULIP_CMD_PCSFUNCTION}, + {"TULIP_CMD_TXTHRSHLDCTL", TULIP_CMD_TXTHRSHLDCTL}, + {"TULIP_CMD_STOREFWD", TULIP_CMD_STOREFWD}, + {"TULIP_CMD_NOHEARTBEAT", TULIP_CMD_NOHEARTBEAT}, + {"TULIP_CMD_PORTSELECT", TULIP_CMD_PORTSELECT}, + {"TULIP_CMD_ENHCAPTEFFCT", TULIP_CMD_ENHCAPTEFFCT}, + {"TULIP_CMD_CAPTREFFCT", TULIP_CMD_CAPTREFFCT}, + {"TULIP_CMD_BACKPRESSURE", TULIP_CMD_BACKPRESSURE}, + {"TULIP_CMD_THRESHOLDCTL", TULIP_CMD_THRESHOLDCTL}, + {"TULIP_CMD_THRSHLD72", TULIP_CMD_THRSHLD72}, + {"TULIP_CMD_THRSHLD96", TULIP_CMD_THRSHLD96}, + {"TULIP_CMD_THRSHLD128", TULIP_CMD_THRSHLD128}, + {"TULIP_CMD_THRSHLD160", TULIP_CMD_THRSHLD160}, + {"TULIP_CMD_TXRUN ", TULIP_CMD_TXRUN }, + {"TULIP_CMD_FORCECOLL", TULIP_CMD_FORCECOLL}, + {"TULIP_CMD_OPERMODE", TULIP_CMD_OPERMODE}, + {"TULIP_CMD_FULLDUPLEX", TULIP_CMD_FULLDUPLEX}, + {"TULIP_CMD_FLAKYOSCDIS", TULIP_CMD_FLAKYOSCDIS}, + {"TULIP_CMD_ALLMULTI", TULIP_CMD_ALLMULTI}, + {"TULIP_CMD_PROMISCUOUS", TULIP_CMD_PROMISCUOUS}, + {"TULIP_CMD_BACKOFFCTR", TULIP_CMD_BACKOFFCTR}, + {"TULIP_CMD_INVFILTER", TULIP_CMD_INVFILTER}, + {"TULIP_CMD_PASSBADPKT", TULIP_CMD_PASSBADPKT}, + {"TULIP_CMD_HASHONLYFLTR", TULIP_CMD_HASHONLYFLTR}, + {"TULIP_CMD_RXRUN", TULIP_CMD_RXRUN}, + {"TULIP_CMD_HASHPRFCTFLTR", TULIP_CMD_HASHPRFCTFLTR}, + {NULL, NULL} +}; +static void tulip_print_cmdmode(tulip_softc_t * const sc) +{ + int i; + + printf("sc->tulip_cmdmode is"); + for ( i = 0 ; tulip_cmdmode_str_tbl[i].name != NULL ; i++ ) { + if ( sc->tulip_cmdmode & tulip_cmdmode_str_tbl[i].mask ) { + printf(" %s", tulip_cmdmode_str_tbl[i].name); + } + } + printf("\n"); +} + +#endif + +/* + * end of file + */ diff -ur pci.orig/if_devar.h pci/if_devar.h --- pci.orig/if_devar.h Mon Aug 30 01:31:36 1999 +++ pci/if_devar.h Mon Jan 3 08:55:59 2000 @@ -78,6 +78,7 @@ #define TULIP_CSR_READBYTE(sc, csr) (inb((sc)->tulip_csrs.csr)) #define TULIP_CSR_WRITEBYTE(sc, csr, val) outb((sc)->tulip_csrs.csr, val) + #endif /* __NetBSD__ */ #else /* TULIP_IOMAPPED */ @@ -269,6 +270,17 @@ #define TULIP_SROM_ATTR_POWERUP 0x0800 #define TULIP_SROM_ATTR_NOLINKPASS 0x1000 +#ifdef TULIP_DEBUG_VERBOSE +static char *tulip_mediainfo_string[] = { + "TULIP_MEDIAINFO_NONE", + "TULIP_MEDIAINFO_SIA", + "TULIP_MEDIAINFO_GPR", + "TULIP_MEDIAINFO_MII", + "TULIP_MEDIAINFO_RESET", + "TULIP_MEDIAINFO_SYM" +}; +#endif + typedef struct { enum { TULIP_MEDIAINFO_NONE, @@ -457,6 +469,17 @@ /* * Various probe states used when trying to autosense the media. */ + +#ifdef TULIP_DEBUG_VERBOSE +static char *tulip_probe_state_str[] = { + "TULIP_PROBE_INACTIVE", + "TULIP_PROBE_PHYRESET", + "TULIP_PROBE_PHYAUTONEG", + "TULIP_PROBE_GPRTEST", + "TULIP_PROBE_MEDIATEST", + "TULIP_PROBE_FAILED" +}; +#endif typedef enum { TULIP_PROBE_INACTIVE,