summaryrefslogtreecommitdiffstats
path: root/sys/dev/dc/dcphy.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1999-12-13 21:45:13 +0000
committerwpaul <wpaul@FreeBSD.org>1999-12-13 21:45:13 +0000
commit20bb20f965ea57ffac6e8a464c771b59a0d22e6b (patch)
tree8e7df981fa76eac21a7e2c85af5773bd74d5fe66 /sys/dev/dc/dcphy.c
parent81282dc10393616ec15c86c322ca38f186c34da5 (diff)
downloadFreeBSD-src-20bb20f965ea57ffac6e8a464c771b59a0d22e6b.zip
FreeBSD-src-20bb20f965ea57ffac6e8a464c771b59a0d22e6b.tar.gz
Fix some problems reported by Mike Pritchard:
- Add a flag DC_TX_INTR_ALWAYS which causes the transmit code to request a TX done interrupt for every packet. The PNIC seems to need this to insure that the sent TX buffers get reaped in a timely fashion. - Try to unreset the SIA as soon as possible after resetting the whole chip. - Change dcphy to support either 10/100 or 10Mbps only NICs. The built-in 21143 ethernet in Compaq Presario machines is 10Mbps only and it doesn't work right if we try to advertise 100Mbps modes during autoneg. When restricted to only 10mbps modes, it works fine. Note that for now, I detect this condition by checking the PCI subsystem ID on this NIC (which has a Compaq vendor/device ID). Yes, I know that's what the SROM is supposed to be for. I'm deliberately ignoring the SROM wherever possible. Sue me. The latter two fixes allow if_dc to work correctly with the built-in ethernet on certain Compaq Presario boxes. There are liable to be quite a few people using these as their home systems who might want to try FreeBSD; may as well be nice to them. Now if anybody out there has an Alpha miata with 10Mbps ethernet and can show me the output from pciconf -l on their system, I'd be grateful.
Diffstat (limited to 'sys/dev/dc/dcphy.c')
-rw-r--r--sys/dev/dc/dcphy.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/sys/dev/dc/dcphy.c b/sys/dev/dc/dcphy.c
index 2543e87..8576d84 100644
--- a/sys/dev/dc/dcphy.c
+++ b/sys/dev/dc/dcphy.c
@@ -86,6 +86,13 @@ static const char rcsid[] =
#define MIIF_AUTOTIMEOUT 0x0004
+/*
+ * This is the subsystem ID for the built-in 21143 ethernet
+ * in several Compaq Presario systems. Apparently these are
+ * 10Mbps only, so we need to treat them specially.
+ */
+#define COMPAQ_PRESARIO_ID 0xb0bb0e11
+
static int dcphy_probe __P((device_t));
static int dcphy_attach __P((device_t));
static int dcphy_detach __P((device_t));
@@ -161,9 +168,6 @@ static int dcphy_attach(dev)
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
BMCR_ISO);
- ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
- BMCR_LOOP|BMCR_S100);
-
/*dcphy_reset(sc);*/
dc_sc = mii->mii_ifp->if_softc;
CSR_WRITE_4(dc_sc, DC_10BTSTAT, 0);
@@ -171,11 +175,14 @@ static int dcphy_attach(dev)
switch(pci_read_config(device_get_parent(sc->mii_dev),
DC_PCI_CSID, 4)) {
- case 0x99999999:
+ case COMPAQ_PRESARIO_ID:
/* Example of how to only allow 10Mbps modes. */
- sc->mii_capabilities = BMSR_10TFDX|BMSR_10THDX;
+ sc->mii_capabilities = BMSR_ANEG|BMSR_10TFDX|BMSR_10THDX;
break;
default:
+ ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP,
+ sc->mii_inst), BMCR_LOOP|BMCR_S100);
+
sc->mii_capabilities =
BMSR_ANEG|BMSR_100TXFDX|BMSR_100TXHDX|
BMSR_10TFDX|BMSR_10THDX;
@@ -418,11 +425,14 @@ dcphy_status(sc)
if (CSR_READ_4(dc_sc, DC_10BTSTAT) & DC_TSTAT_LP_CAN_NWAY) {
anlpar = CSR_READ_4(dc_sc, DC_10BTSTAT) >> 16;
- if (anlpar & ANLPAR_T4)
+ if (anlpar & ANLPAR_T4 &&
+ sc->mii_capabilities & BMSR_100TXHDX)
mii->mii_media_active |= IFM_100_T4;
- else if (anlpar & ANLPAR_TX_FD)
+ else if (anlpar & ANLPAR_TX_FD &&
+ sc->mii_capabilities & BMSR_100TXHDX)
mii->mii_media_active |= IFM_100_TX|IFM_FDX;
- else if (anlpar & ANLPAR_TX)
+ else if (anlpar & ANLPAR_TX &&
+ sc->mii_capabilities & BMSR_100TXHDX)
mii->mii_media_active |= IFM_100_TX;
else if (anlpar & ANLPAR_10_FD)
mii->mii_media_active |= IFM_10_T|IFM_FDX;
@@ -478,7 +488,10 @@ dcphy_auto(mii, waitfor)
DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL);
DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_FULLDUPLEX);
DC_CLRBIT(sc, DC_SIARESET, DC_SIA_RESET);
- CSR_WRITE_4(sc, DC_10BTCTRL, 0x3FFFF);
+ if (mii->mii_capabilities & BMSR_100TXHDX)
+ CSR_WRITE_4(sc, DC_10BTCTRL, 0x3FFFF);
+ else
+ CSR_WRITE_4(sc, DC_10BTCTRL, 0xFFFF);
DC_SETBIT(sc, DC_SIARESET, DC_SIA_RESET);
DC_SETBIT(sc, DC_10BTCTRL, DC_TCTL_AUTONEGENBL);
DC_SETBIT(sc, DC_10BTSTAT, DC_ASTAT_TXDISABLE);
OpenPOWER on IntegriCloud