summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_mx.c84
-rw-r--r--sys/dev/pci/if_mxreg.h4
-rw-r--r--sys/dev/pci/if_pn.c38
-rw-r--r--sys/dev/pci/if_rl.c11
-rw-r--r--sys/dev/pci/if_tl.c59
-rw-r--r--sys/dev/pci/if_xl.c101
-rw-r--r--sys/dev/pci/if_xlreg.h4
7 files changed, 37 insertions, 264 deletions
diff --git a/sys/dev/pci/if_mx.c b/sys/dev/pci/if_mx.c
index 230ff2c366b..0e8e0029cee 100644
--- a/sys/dev/pci/if_mx.c
+++ b/sys/dev/pci/if_mx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mx.c,v 1.4 1999/02/27 19:15:26 jason Exp $ */
+/* $OpenBSD: if_mx.c,v 1.5 1999/03/03 22:51:46 jason Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -92,7 +92,6 @@
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
-#define bootverbose 0
#define MX_USEIOSPACE
@@ -100,22 +99,6 @@
#include <dev/pci/if_mxreg.h>
-/*
- * Various supported PHY vendors/types and their names. Note that
- * this driver will work with pretty much any MII-compliant PHY,
- * so failure to positively identify the chip is not a fatal error.
- */
-
-static struct mx_type mx_phys[] = {
- { TI_PHY_VENDORID, TI_PHY_10BT, "<TI ThunderLAN 10BT (internal)>" },
- { TI_PHY_VENDORID, TI_PHY_100VGPMI, "<TI TNETE211 100VG Any-LAN>" },
- { NS_PHY_VENDORID, NS_PHY_83840A, "<National Semiconductor DP83840A>"},
- { LEVEL1_PHY_VENDORID, LEVEL1_PHY_LXT970, "<Level 1 LXT970>" },
- { INTEL_PHY_VENDORID, INTEL_PHY_82555, "<Intel 82555>" },
- { SEEQ_PHY_VENDORID, SEEQ_PHY_80220, "<SEEQ 80220>" },
- { 0, 0, "<MII-compliant physical interface>" }
-};
-
static int mx_probe __P((struct device *, void *, void *));
static void mx_attach __P((struct device *, struct device *self, void *aux));
@@ -870,34 +853,23 @@ static void mx_getmode_mii(sc)
ifp = &sc->arpcom.ac_if;
bmsr = mx_phy_readreg(sc, PHY_BMSR);
- if (bootverbose)
- printf("mx%d: PHY status word: %x\n", sc->mx_unit, bmsr);
/* fallback */
sc->ifmedia.ifm_media = IFM_ETHER|IFM_10_T|IFM_HDX;
if (bmsr & PHY_BMSR_10BTHALF) {
- if (bootverbose)
- printf("mx%d: 10Mbps half-duplex mode supported\n",
- sc->mx_unit);
ifmedia_add(&sc->ifmedia,
IFM_ETHER|IFM_10_T|IFM_HDX, 0, NULL);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T, 0, NULL);
}
if (bmsr & PHY_BMSR_10BTFULL) {
- if (bootverbose)
- printf("mx%d: 10Mbps full-duplex mode supported\n",
- sc->mx_unit);
ifmedia_add(&sc->ifmedia,
IFM_ETHER|IFM_10_T|IFM_FDX, 0, NULL);
sc->ifmedia.ifm_media = IFM_ETHER|IFM_10_T|IFM_FDX;
}
if (bmsr & PHY_BMSR_100BTXHALF) {
- if (bootverbose)
- printf("mx%d: 100Mbps half-duplex mode supported\n",
- sc->mx_unit);
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_100_TX, 0, NULL);
ifmedia_add(&sc->ifmedia,
@@ -906,9 +878,6 @@ static void mx_getmode_mii(sc)
}
if (bmsr & PHY_BMSR_100BTXFULL) {
- if (bootverbose)
- printf("mx%d: 100Mbps full-duplex mode supported\n",
- sc->mx_unit);
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia,
IFM_ETHER|IFM_100_TX|IFM_FDX, 0, NULL);
@@ -917,23 +886,16 @@ static void mx_getmode_mii(sc)
/* Some also support 100BaseT4. */
if (bmsr & PHY_BMSR_100BT4) {
- if (bootverbose)
- printf("mx%d: 100baseT4 mode supported\n", sc->mx_unit);
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_100_T4, 0, NULL);
sc->ifmedia.ifm_media = IFM_ETHER|IFM_100_T4;
#ifdef FORCE_AUTONEG_TFOUR
- if (bootverbose)
- printf("mx%d: forcing on autoneg support for BT4\n",
- sc->mx_unit);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_AUTO, 0 NULL):
sc->ifmedia.ifm_media = IFM_ETHER|IFM_AUTO;
#endif
}
if (bmsr & PHY_BMSR_CANAUTONEG) {
- if (bootverbose)
- printf("mx%d: autoneg supported\n", sc->mx_unit);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_AUTO, 0, NULL);
sc->ifmedia.ifm_media = IFM_ETHER|IFM_AUTO;
}
@@ -1487,7 +1449,7 @@ static void mx_txeoc(sc)
sc->mx_cdata.mx_tx_tail = NULL;
if (sc->mx_want_auto) {
if (sc->mx_type == MX_TYPE_98713 &&
- sc->mx_pinfo != NULL)
+ sc->mx_hasmii != 0)
mx_autoneg_mii(sc, MX_FLAG_DELAYTIMEO, 1);
else
mx_autoneg(sc, MX_FLAG_DELAYTIMEO, 1);
@@ -1772,7 +1734,7 @@ static void mx_init(xsc)
s = splimp();
- if (sc->mx_pinfo != NULL)
+ if (sc->mx_hasmii != 0)
phy_bmcr = mx_phy_readreg(sc, PHY_BMCR);
/*
@@ -1805,7 +1767,7 @@ static void mx_init(xsc)
else
MX_SETBIT(sc, MX_MAGICPACKET, MX_MAGIC_98715);
- if (sc->mx_pinfo != NULL) {
+ if (sc->mx_hasmii != 0) {
MX_SETBIT(sc, MX_WATCHDOG, MX_WDOG_JABBERDIS);
mx_setcfg(sc, mx_phy_readreg(sc, PHY_BMCR));
} else
@@ -1821,8 +1783,7 @@ static void mx_init(xsc)
/* Init circular RX list. */
if (mx_list_rx_init(sc) == ENOBUFS) {
- printf("mx%d: initialization failed: no "
- "memory for rx buffers\n", sc->mx_unit);
+ printf("mx%d: no memory for rx buffers\n", sc->mx_unit);
mx_stop(sc);
(void)splx(s);
return;
@@ -1854,7 +1815,7 @@ static void mx_init(xsc)
CSR_WRITE_4(sc, MX_RXSTART, 0xFFFFFFFF);
/* Restore state of BMCR */
- if (sc->mx_pinfo != NULL)
+ if (sc->mx_hasmii != 0)
mx_phy_writereg(sc, PHY_BMCR, phy_bmcr);
ifp->if_flags |= IFF_RUNNING;
@@ -1880,7 +1841,7 @@ static int mx_ifmedia_upd(ifp)
if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
return(EINVAL);
- if (sc->mx_type == MX_TYPE_98713 && sc->mx_pinfo != NULL) {
+ if (sc->mx_type == MX_TYPE_98713 && sc->mx_hasmii != 0) {
if (IFM_SUBTYPE(ifm->ifm_media) == IFM_AUTO)
mx_autoneg_mii(sc, MX_FLAG_SCHEDDELAY, 1);
else
@@ -1910,7 +1871,7 @@ static void mx_ifmedia_sts(ifp, ifmr)
ifmr->ifm_active = IFM_ETHER;
- if (sc->mx_type != MX_TYPE_98713 || sc->mx_pinfo == NULL) {
+ if (sc->mx_type != MX_TYPE_98713 || sc->mx_hasmii == 0) {
media = CSR_READ_4(sc, MX_NETCFG);
if (media & MX_NETCFG_PORTSEL)
ifmr->ifm_active = IFM_ETHER|IFM_100_TX;
@@ -2025,7 +1986,7 @@ static void mx_watchdog(ifp)
sc = ifp->if_softc;
if (sc->mx_autoneg) {
- if (sc->mx_type == MX_TYPE_98713 && sc->mx_pinfo != NULL)
+ if (sc->mx_type == MX_TYPE_98713 && sc->mx_hasmii != 0)
mx_autoneg_mii(sc, MX_FLAG_DELAYTIMEO, 1);
else
mx_autoneg(sc, MX_FLAG_DELAYTIMEO, 1);
@@ -2035,7 +1996,7 @@ static void mx_watchdog(ifp)
ifp->if_oerrors++;
printf("mx%d: watchdog timeout\n", sc->mx_unit);
- if (sc->mx_pinfo == NULL) {
+ if (sc->mx_hasmii == 0) {
if (!(CSR_READ_4(sc, MX_10BTSTAT) & MX_TSTAT_LS10) ||
!(CSR_READ_4(sc, MX_10BTSTAT) & MX_TSTAT_LS100))
printf("mx%d: no carrier - transceiver "
@@ -2140,7 +2101,6 @@ mx_attach(parent, self, aux)
u_int32_t command;
u_int16_t phy_sts, phy_did, phy_vid, mac_offset = 0;
int s, i, media;
- struct mx_type *p = NULL;
s = splimp();
@@ -2150,15 +2110,15 @@ mx_attach(parent, self, aux)
#ifdef MX_USEIOSPACE
if (!(command & PCI_COMMAND_IO_ENABLE)) {
- printf(": failed to enable I/O ports\n");
+ printf(": failed to enable i/o ports\n");
goto fail;
}
if (pci_io_find(pc, pa->pa_tag, MX_PCI_LOIO, &iobase, &iosize)) {
- printf(": failed to find i/o space\n");
+ printf(": can't find i/o space\n");
goto fail;
}
if (bus_space_map(pa->pa_iot, iobase, iosize, 0, &sc->mx_bhandle)) {
- printf(": failed map i/o space\n");
+ printf(": can't map i/o space\n");
goto fail;
}
sc->mx_btag = pa->pa_iot;
@@ -2168,11 +2128,11 @@ mx_attach(parent, self, aux)
goto fail;
}
if (pci_mem_find(pc, pa->pa_tag, MX_PCI_LOMEM, &iobase, &iosize)) {
- printf(": failed to find memory space\n");
+ printf(": can't find mem space\n");
goto fail;
}
if (bus_space_map(pa->pa_memt, iobase, iosize, 0, &sc->mx_bhandle)) {
- printf(": failed map memory space\n");
+ printf(": can't map mem space\n");
goto fail;
}
sc->mx_btag = pa->pa_memt;
@@ -2258,17 +2218,7 @@ mx_attach(parent, self, aux)
if (phy_sts) {
phy_vid = mx_phy_readreg(sc, PHY_VENID);
phy_did = mx_phy_readreg(sc, PHY_DEVID);
- p = mx_phys;
- while (p->mx_vid) {
- if (phy_vid == p->mx_vid &&
- (phy_did|0xf) == p->mx_did) {
- sc->mx_pinfo = p;
- break;
- }
- p++;
- }
- if (sc->mx_pinfo == NULL)
- sc->mx_pinfo = &mx_phys[PHY_UNKNOWN];
+ sc->mx_hasmii = 1;
}
else {
printf("%s: MII without any phy!\n",
@@ -2278,7 +2228,7 @@ mx_attach(parent, self, aux)
}
ifmedia_init(&sc->ifmedia, 0, mx_ifmedia_upd, mx_ifmedia_sts);
- if (sc->mx_type == MX_TYPE_98713 && sc->mx_pinfo != NULL) {
+ if (sc->mx_type == MX_TYPE_98713 && sc->mx_hasmii != 0) {
mx_getmode_mii(sc);
mx_autoneg_mii(sc, MX_FLAG_FORCEDELAY, 1);
} else {
diff --git a/sys/dev/pci/if_mxreg.h b/sys/dev/pci/if_mxreg.h
index 4da5c64c52d..fa758f41a70 100644
--- a/sys/dev/pci/if_mxreg.h
+++ b/sys/dev/pci/if_mxreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mxreg.h,v 1.1 1999/01/08 04:43:18 jason Exp $ */
+/* $OpenBSD: if_mxreg.h,v 1.2 1999/03/03 22:51:48 jason Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -487,7 +487,7 @@ struct mx_softc {
bus_space_handle_t mx_bhandle; /* bus space handle */
bus_space_tag_t mx_btag; /* bus space tag */
struct mx_type *mx_info; /* Macronix adapter info */
- struct mx_type *mx_pinfo; /* phy info */
+ u_int8_t mx_hasmii; /* whether we have mii */
u_int8_t mx_unit; /* interface number */
u_int8_t mx_type;
u_int8_t mx_phy_addr; /* PHY address */
diff --git a/sys/dev/pci/if_pn.c b/sys/dev/pci/if_pn.c
index e772778120e..9ef43fcc22f 100644
--- a/sys/dev/pci/if_pn.c
+++ b/sys/dev/pci/if_pn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pn.c,v 1.3 1999/02/27 18:44:58 jason Exp $ */
+/* $OpenBSD: if_pn.c,v 1.4 1999/03/03 22:51:48 jason Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -92,7 +92,6 @@
#endif /* FreeBSD */
#ifdef __OpenBSD__
-#define bootverbose 0
#include <vm/vm.h> /* for vtophys */
#include <vm/pmap.h> /* for vtophys */
#include <sys/device.h>
@@ -512,34 +511,23 @@ static void pn_getmode_mii(sc)
ifp = &sc->arpcom.ac_if;
bmsr = pn_phy_readreg(sc, PHY_BMSR);
- if (bootverbose)
- printf("pn%d: PHY status word: %x\n", sc->pn_unit, bmsr);
/* fallback */
sc->ifmedia.ifm_media = IFM_ETHER|IFM_10_T|IFM_HDX;
if (bmsr & PHY_BMSR_10BTHALF) {
- if (bootverbose)
- printf("pn%d: 10Mbps half-duplex mode supported\n",
- sc->pn_unit);
ifmedia_add(&sc->ifmedia,
IFM_ETHER|IFM_10_T|IFM_HDX, 0, NULL);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T, 0, NULL);
}
if (bmsr & PHY_BMSR_10BTFULL) {
- if (bootverbose)
- printf("pn%d: 10Mbps full-duplex mode supported\n",
- sc->pn_unit);
ifmedia_add(&sc->ifmedia,
IFM_ETHER|IFM_10_T|IFM_FDX, 0, NULL);
sc->ifmedia.ifm_media = IFM_ETHER|IFM_10_T|IFM_FDX;
}
if (bmsr & PHY_BMSR_100BTXHALF) {
- if (bootverbose)
- printf("pn%d: 100Mbps half-duplex mode supported\n",
- sc->pn_unit);
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_100_TX, 0, NULL);
ifmedia_add(&sc->ifmedia,
@@ -548,9 +536,6 @@ static void pn_getmode_mii(sc)
}
if (bmsr & PHY_BMSR_100BTXFULL) {
- if (bootverbose)
- printf("pn%d: 100Mbps full-duplex mode supported\n",
- sc->pn_unit);
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia,
IFM_ETHER|IFM_100_TX|IFM_FDX, 0, NULL);
@@ -559,23 +544,16 @@ static void pn_getmode_mii(sc)
/* Some also support 100BaseT4. */
if (bmsr & PHY_BMSR_100BT4) {
- if (bootverbose)
- printf("pn%d: 100baseT4 mode supported\n", sc->pn_unit);
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_100_T4, 0, NULL);
sc->ifmedia.ifm_media = IFM_ETHER|IFM_100_T4;
#ifdef FORCE_AUTONEG_TFOUR
- if (bootverbose)
- printf("pn%d: forcing on autoneg support for BT4\n",
- sc->pn_unit);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_AUTO, 0 NULL):
sc->ifmedia.ifm_media = IFM_ETHER|IFM_AUTO;
#endif
}
if (bmsr & PHY_BMSR_CANAUTONEG) {
- if (bootverbose)
- printf("pn%d: autoneg supported\n", sc->pn_unit);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_AUTO, 0, NULL);
sc->ifmedia.ifm_media = IFM_ETHER|IFM_AUTO;
}
@@ -1003,12 +981,7 @@ pn_attach(config_id, unit)
ifp->if_baudrate = 10000000;
ifp->if_snd.ifq_maxlen = PN_TX_LIST_CNT - 1;
- if (bootverbose)
- printf("pn%d: probing for a PHY\n", sc->pn_unit);
for (i = PN_PHYADDR_MIN; i < PN_PHYADDR_MAX + 1; i++) {
- if (bootverbose)
- printf("pn%d: checking address: %d\n",
- sc->pn_unit, i);
sc->pn_phy_addr = i;
pn_phy_writereg(sc, PHY_BMCR, PHY_BMCR_RESET);
DELAY(500);
@@ -1020,12 +993,6 @@ pn_attach(config_id, unit)
if (phy_sts) {
phy_vid = pn_phy_readreg(sc, PHY_VENID);
phy_did = pn_phy_readreg(sc, PHY_DEVID);
- if (bootverbose)
- printf("pn%d: found PHY at address %d, ",
- sc->pn_unit, sc->pn_phy_addr);
- if (bootverbose)
- printf("vendor id: %x device id: %x\n",
- phy_vid, phy_did);
p = pn_phys;
while(p->pn_vid) {
if (phy_vid == p->pn_vid &&
@@ -1037,9 +1004,6 @@ pn_attach(config_id, unit)
}
if (sc->pn_pinfo == NULL)
sc->pn_pinfo = &pn_phys[PHY_UNKNOWN];
- if (bootverbose)
- printf("pn%d: PHY type: %s\n",
- sc->pn_unit, sc->pn_pinfo->pn_name);
} else {
printf("pn%d: MII without any phy!\n", sc->pn_unit);
goto fail;
diff --git a/sys/dev/pci/if_rl.c b/sys/dev/pci/if_rl.c
index 1b5f8320763..259649c6947 100644
--- a/sys/dev/pci/if_rl.c
+++ b/sys/dev/pci/if_rl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rl.c,v 1.13 1999/02/26 21:25:44 jason Exp $ */
+/* $OpenBSD: if_rl.c,v 1.14 1999/03/03 22:51:49 jason Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -143,7 +143,6 @@
* so failure to positively identify the chip is not a fatal error.
*/
-#define bootverbose 0
static int rl_probe __P((struct device *, void *, void *));
static void rl_attach __P((struct device *, struct device *, void *));
static int rl_intr __P((void *));
@@ -1392,12 +1391,12 @@ rl_attach(parent, self, aux)
sc->sc_dmat = pa->pa_dmat;
if (bus_dmamem_alloc(sc->sc_dmat, RL_RXBUFLEN + 16, PAGE_SIZE, 0, &seg,
1, &rseg, BUS_DMA_NOWAIT)) {
- printf("\n%s: cannot alloc rx buffers\n", sc->sc_dev.dv_xname);
+ printf("\n%s: can't alloc rx buffers\n", sc->sc_dev.dv_xname);
return;
}
if (bus_dmamem_map(sc->sc_dmat, &seg, rseg, RL_RXBUFLEN + 16, &kva,
BUS_DMA_NOWAIT | BUS_DMAMEM_NOSYNC)) {
- printf("\n%s: cannot map dma buffers (%d bytes)\n",
+ printf("\n%s: can't map dma buffers (%d bytes)\n",
sc->sc_dev.dv_xname, RL_RXBUFLEN + 16);
bus_dmamem_free(sc->sc_dmat, &seg, rseg);
return;
@@ -1405,14 +1404,14 @@ rl_attach(parent, self, aux)
sc->sc_dma_mapsize = RL_RXBUFLEN + 16;
if (bus_dmamap_create(sc->sc_dmat, RL_RXBUFLEN + 16, 1,
RL_RXBUFLEN + 16, 0, BUS_DMA_NOWAIT, &sc->sc_dma_mem)) {
- printf("\n%s: cannot create dma map\n");
+ printf("\n%s: can't create dma map\n");
bus_dmamem_unmap(sc->sc_dmat, kva, RL_RXBUFLEN + 16);
bus_dmamem_free(sc->sc_dmat, &seg, rseg);
return;
}
if (bus_dmamap_load(sc->sc_dmat, sc->sc_dma_mem, kva,
RL_RXBUFLEN + 16, NULL, BUS_DMA_NOWAIT)) {
- printf("\n%s: cannot load dma map\n");
+ printf("\n%s: can't load dma map\n");
bus_dmamem_unmap(sc->sc_dmat, kva, RL_RXBUFLEN + 16);
bus_dmamem_free(sc->sc_dmat, &seg, rseg);
bus_dmamap_destroy(sc->sc_dmat, sc->sc_dma_mem);
diff --git a/sys/dev/pci/if_tl.c b/sys/dev/pci/if_tl.c
index 3c25c5cc1fe..2e081824847 100644
--- a/sys/dev/pci/if_tl.c
+++ b/sys/dev/pci/if_tl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tl.c,v 1.8 1999/02/27 19:05:43 jason Exp $ */
+/* $OpenBSD: if_tl.c,v 1.9 1999/03/03 22:51:50 jason Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -225,8 +225,6 @@
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
-
-#define bootverbose 0
#endif
/*
@@ -331,7 +329,6 @@ static struct tl_type tl_devs[] = {
"Olicom OC-2326 10/100 TX UTP" },
{ 0, 0, NULL }
};
-#endif
/*
* Various supported PHY vendors/types and their names. Note that
@@ -348,6 +345,7 @@ static struct tl_type tl_phys[] = {
{ SEEQ_PHY_VENDORID, SEEQ_PHY_80220, "<SEEQ 80220>" },
{ 0, 0, "<MII-compliant physical interface>" }
};
+#endif
#ifdef __FreeBSD__
static unsigned long tl_count;
@@ -1470,7 +1468,6 @@ static int tl_attach_phy(sc)
struct tl_softc *sc;
{
int phy_ctl;
- struct tl_type *p = tl_phys;
int media = IFM_ETHER|IFM_100_TX|IFM_FDX;
struct ifnet *ifp;
@@ -1481,22 +1478,6 @@ static int tl_attach_phy(sc)
sc->tl_phy_sts = tl_phy_readreg(sc, TL_PHY_GENSTS);
phy_ctl = tl_phy_readreg(sc, TL_PHY_GENCTL);
- /*
- * PHY revision numbers tend to vary a bit. Our algorithm here
- * is to check everything but the 8 least significant bits.
- */
- while(p->tl_vid) {
- if (sc->tl_phy_vid == p->tl_vid &&
- (sc->tl_phy_did | 0x000F) == p->tl_did) {
- sc->tl_pinfo = p;
- break;
- }
- p++;
- }
- if (sc->tl_pinfo == NULL) {
- sc->tl_pinfo = &tl_phys[PHY_UNKNOWN];
- }
-
if (sc->tl_phy_sts & PHY_BMSR_100BT4 ||
sc->tl_phy_sts & PHY_BMSR_100BTXFULL ||
sc->tl_phy_sts & PHY_BMSR_100BTXHALF)
@@ -1504,47 +1485,23 @@ static int tl_attach_phy(sc)
else
ifp->if_baudrate = 10000000;
- if (bootverbose) {
- printf("tl%d: phy at mii address %d\n", sc->tl_unit,
- sc->tl_phy_addr);
-
- printf("tl%d: %s ", sc->tl_unit, sc->tl_pinfo->tl_name);
- }
-
if (sc->tl_phy_sts & PHY_BMSR_100BT4 ||
sc->tl_phy_sts & PHY_BMSR_100BTXHALF ||
sc->tl_phy_sts & PHY_BMSR_100BTXHALF) {
- if (bootverbose)
- printf("10/100Mbps ");
} else {
media &= ~IFM_100_TX;
media |= IFM_10_T;
- if (bootverbose)
- printf("10Mbps ");
}
if (sc->tl_phy_sts & PHY_BMSR_100BTXFULL ||
sc->tl_phy_sts & PHY_BMSR_10BTFULL) {
- if (bootverbose)
- printf("full duplex ");
} else {
- if (bootverbose)
- printf("half duplex ");
media &= ~IFM_FDX;
}
if (sc->tl_phy_sts & PHY_BMSR_CANAUTONEG) {
media = IFM_ETHER|IFM_AUTO;
- if (bootverbose)
- printf("autonegotiating\n");
- } else
- if (bootverbose)
- printf("\n");
-
- /* If this isn't a known PHY, print the PHY indentifier info. */
- if (sc->tl_pinfo->tl_vid == 0 && bootverbose)
- printf("tl%d: vendor id: %04x product id: %04x\n",
- sc->tl_unit, sc->tl_phy_vid, sc->tl_phy_did);
+ }
/* Set up ifmedia data and callbacks. */
ifmedia_init(&sc->ifmedia, 0, tl_ifmedia_upd, tl_ifmedia_sts);
@@ -1813,14 +1770,10 @@ tl_attach(config_id, unit)
for (i = TL_PHYADDR_MIN; i < TL_PHYADDR_MAX + 1; i++) {
sc->tl_phy_addr = i;
- if (bootverbose)
- printf("tl%d: looking for phy at addr %x\n", unit, i);
tl_phy_writereg(sc, PHY_BMCR, PHY_BMCR_RESET);
DELAY(500);
while(tl_phy_readreg(sc, PHY_BMCR) & PHY_BMCR_RESET);
sc->tl_phy_sts = tl_phy_readreg(sc, PHY_BMSR);
- if (bootverbose)
- printf("tl%d: status: %x\n", unit, sc->tl_phy_sts);
if (!sc->tl_phy_sts)
continue;
if (tl_attach_phy(sc)) {
@@ -3196,16 +3149,10 @@ tl_attach(parent, self, aux)
for (i = TL_PHYADDR_MIN; i < TL_PHYADDR_MAX + 1; i++) {
sc->tl_phy_addr = i;
- if (bootverbose)
- printf("%s: looking for phy at addr %x\n",
- sc->sc_dev.dv_xname, i);
tl_phy_writereg(sc, PHY_BMCR, PHY_BMCR_RESET);
DELAY(500);
while(tl_phy_readreg(sc, PHY_BMCR) & PHY_BMCR_RESET);
sc->tl_phy_sts = tl_phy_readreg(sc, PHY_BMSR);
- if (bootverbose)
- printf("%s: status: %x\n", sc->sc_dev.dv_xname,
- sc->tl_phy_sts);
if (!sc->tl_phy_sts)
continue;
if (tl_attach_phy(sc)) {
diff --git a/sys/dev/pci/if_xl.c b/sys/dev/pci/if_xl.c
index 74b73e9a874..f703c74214c 100644
--- a/sys/dev/pci/if_xl.c
+++ b/sys/dev/pci/if_xl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xl.c,v 1.22 1999/03/02 02:25:39 jason Exp $ */
+/* $OpenBSD: if_xl.c,v 1.23 1999/03/03 22:51:51 jason Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -114,8 +114,6 @@
#elif defined(__OpenBSD__)
-#define bootverbose 0
-
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
@@ -225,7 +223,6 @@ static struct xl_type xl_devs[] = {
"3Com 3c980 Fast Etherlink XL 10/100BaseTX" },
{ 0, 0, NULL }
};
-#endif
/*
* Various supported PHY vendors/types and their names. Note that
@@ -242,6 +239,7 @@ static struct xl_type xl_phys[] = {
{ SEEQ_PHY_VENDORID, SEEQ_PHY_80220, "<SEEQ 80220>" },
{ 0, 0, "<MII-compliant physical interface>" }
};
+#endif
#if defined(__FreeBSD__)
static unsigned long xl_count = 0;
@@ -1013,34 +1011,23 @@ static void xl_getmode_mii(sc)
ifp = &sc->arpcom.ac_if;
bmsr = xl_phy_readreg(sc, PHY_BMSR);
- if (bootverbose)
- printf("xl%d: PHY status word: %x\n", sc->xl_unit, bmsr);
/* fallback */
sc->ifmedia.ifm_media = IFM_ETHER|IFM_10_T|IFM_HDX;
if (bmsr & PHY_BMSR_10BTHALF) {
- if (bootverbose)
- printf("xl%d: 10Mbps half-duplex mode supported\n",
- sc->xl_unit);
ifmedia_add(&sc->ifmedia,
IFM_ETHER|IFM_10_T|IFM_HDX, 0, NULL);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T, 0, NULL);
}
if (bmsr & PHY_BMSR_10BTFULL) {
- if (bootverbose)
- printf("xl%d: 10Mbps full-duplex mode supported\n",
- sc->xl_unit);
ifmedia_add(&sc->ifmedia,
IFM_ETHER|IFM_10_T|IFM_FDX, 0, NULL);
sc->ifmedia.ifm_media = IFM_ETHER|IFM_10_T|IFM_FDX;
}
if (bmsr & PHY_BMSR_100BTXHALF) {
- if (bootverbose)
- printf("xl%d: 100Mbps half-duplex mode supported\n",
- sc->xl_unit);
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_100_TX, 0, NULL);
ifmedia_add(&sc->ifmedia,
@@ -1049,9 +1036,6 @@ static void xl_getmode_mii(sc)
}
if (bmsr & PHY_BMSR_100BTXFULL) {
- if (bootverbose)
- printf("xl%d: 100Mbps full-duplex mode supported\n",
- sc->xl_unit);
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia,
IFM_ETHER|IFM_100_TX|IFM_FDX, 0, NULL);
@@ -1060,23 +1044,16 @@ static void xl_getmode_mii(sc)
/* Some also support 100BaseT4. */
if (bmsr & PHY_BMSR_100BT4) {
- if (bootverbose)
- printf("xl%d: 100baseT4 mode supported\n", sc->xl_unit);
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_100_T4, 0, NULL);
sc->ifmedia.ifm_media = IFM_ETHER|IFM_100_T4;
#ifdef FORCE_AUTONEG_TFOUR
- if (bootverbose)
- printf("xl%d: forcing on autoneg support for BT4\n",
- sc->xl_unit);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_AUTO, 0, NULL);
sc->ifmedia.ifm_media = IFM_ETHER|IFM_AUTO;
#endif
}
if (bmsr & PHY_BMSR_CANAUTONEG) {
- if (bootverbose)
- printf("xl%d: autoneg supported\n", sc->xl_unit);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_AUTO, 0, NULL);
sc->ifmedia.ifm_media = IFM_ETHER|IFM_AUTO;
}
@@ -1571,9 +1548,6 @@ xl_attach(config_id, unit)
*/
XL_SEL_WIN(3);
sc->xl_media = CSR_READ_2(sc, XL_W3_MEDIA_OPT);
- if (bootverbose)
- printf("xl%d: media options word: %x\n", sc->xl_unit,
- sc->xl_media);
xl_read_eeprom(sc, (char *)&sc->xl_xcvr, XL_EE_ICFG_0, 2, 0);
sc->xl_xcvr &= XL_ICFG_CONNECTOR_MASK;
@@ -1603,12 +1577,7 @@ xl_attach(config_id, unit)
icfg |= (XL_XCVR_100BFX << XL_ICFG_CONNECTOR_BITS);
CSR_WRITE_4(sc, XL_W3_INTERNAL_CFG, icfg);
- if (bootverbose)
- printf("xl%d: probing for a PHY\n", sc->xl_unit);
for (i = XL_PHYADDR_MIN; i < XL_PHYADDR_MAX + 1; i++) {
- if (bootverbose)
- printf("xl%d: checking address: %d\n",
- sc->xl_unit, i);
sc->xl_phy_addr = i;
xl_phy_writereg(sc, XL_PHY_GENCTL, PHY_BMCR_RESET);
DELAY(500);
@@ -1620,12 +1589,6 @@ xl_attach(config_id, unit)
if (phy_sts) {
phy_vid = xl_phy_readreg(sc, XL_PHY_VENID);
phy_did = xl_phy_readreg(sc, XL_PHY_DEVID);
- if (bootverbose)
- printf("xl%d: found PHY at address %d, ",
- sc->xl_unit, sc->xl_phy_addr);
- if (bootverbose)
- printf("vendor id: %x device id: %x\n",
- phy_vid, phy_did);
p = xl_phys;
while(p->xl_vid) {
if (phy_vid == p->xl_vid &&
@@ -1637,9 +1600,6 @@ xl_attach(config_id, unit)
}
if (sc->xl_pinfo == NULL)
sc->xl_pinfo = &xl_phys[PHY_UNKNOWN];
- if (bootverbose)
- printf("xl%d: PHY type: %s\n",
- sc->xl_unit, sc->xl_pinfo->xl_name);
} else {
printf("xl%d: MII without any phy!\n", sc->xl_unit);
}
@@ -1651,8 +1611,6 @@ xl_attach(config_id, unit)
ifmedia_init(&sc->ifmedia, 0, xl_ifmedia_upd, xl_ifmedia_sts);
if (sc->xl_media & XL_MEDIAOPT_BT) {
- if (bootverbose)
- printf("xl%d: found 10baseT\n", sc->xl_unit);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T, 0, NULL);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T|IFM_HDX, 0, NULL);
if (sc->xl_caps & XL_CAPS_FULL_DUPLEX)
@@ -1661,14 +1619,10 @@ xl_attach(config_id, unit)
}
if (sc->xl_media & XL_MEDIAOPT_AUI) {
- if (bootverbose)
- printf("xl%d: found AUI\n", sc->xl_unit);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_5, 0, NULL);
}
if (sc->xl_media & XL_MEDIAOPT_BNC) {
- if (bootverbose)
- printf("xl%d: found BNC\n", sc->xl_unit);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_2, 0, NULL);
}
@@ -1679,8 +1633,6 @@ xl_attach(config_id, unit)
* do it and get it over with.
*/
if (sc->xl_media & XL_MEDIAOPT_BTX) {
- if (bootverbose)
- printf("xl%d: found 100baseTX\n", sc->xl_unit);
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_100_TX, 0, NULL);
ifmedia_add(&sc->ifmedia,
@@ -1688,13 +1640,11 @@ xl_attach(config_id, unit)
if (sc->xl_caps & XL_CAPS_FULL_DUPLEX)
ifmedia_add(&sc->ifmedia,
IFM_ETHER|IFM_100_TX|IFM_FDX, 0, NULL);
- if (sc->xl_pinfo != NULL)
+ if (sc->xl_hasmii != 0)
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_AUTO, 0, NULL);
}
if (sc->xl_media & XL_MEDIAOPT_BFX) {
- if (bootverbose)
- printf("xl%d: found 100baseFX\n", sc->xl_unit);
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_100_FX, 0, NULL);
}
@@ -1704,8 +1654,6 @@ xl_attach(config_id, unit)
* separately.
*/
if (sc->xl_media & XL_MEDIAOPT_MII || sc->xl_media & XL_MEDIAOPT_BT4) {
- if (bootverbose)
- printf("xl%d: found MII\n", sc->xl_unit);
xl_getmode_mii(sc);
}
@@ -2477,7 +2425,7 @@ static void xl_init(xsc)
* to preserve it. (For 3c905 cards with real external PHYs,
* the BMCR register doesn't change, but this doesn't hurt.)
*/
- if (sc->xl_pinfo != NULL)
+ if (sc->xl_hasmii != 0)
phy_bmcr = xl_phy_readreg(sc, PHY_BMCR);
/*
@@ -2624,7 +2572,7 @@ static void xl_init(xsc)
CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_ENABLE);
/* Restore state of BMCR */
- if (sc->xl_pinfo != NULL)
+ if (sc->xl_hasmii != 0)
xl_phy_writereg(sc, PHY_BMCR, phy_bmcr);
/* Select window 7 for normal operations. */
@@ -2998,7 +2946,6 @@ xl_attach(parent, self, aux)
caddr_t roundptr;
u_int round;
int i, media = IFM_ETHER|IFM_100_TX|IFM_FDX;
- struct xl_type *p;
sc->xl_unit = sc->sc_dev.dv_unit;
@@ -3172,9 +3119,6 @@ xl_attach(parent, self, aux)
XL_SEL_WIN(3);
sc->xl_media = CSR_READ_2(sc, XL_W3_MEDIA_OPT);
- if (bootverbose)
- printf("xl%d: media options word: %x\n",
- sc->xl_unit, sc->xl_media);
xl_read_eeprom(sc, (char *)&sc->xl_xcvr, XL_EE_ICFG_0, 2, 0);
sc->xl_xcvr &= XL_ICFG_CONNECTOR_MASK;
@@ -3216,26 +3160,7 @@ xl_attach(parent, self, aux)
if (phy_sts) {
phy_vid = xl_phy_readreg(sc, XL_PHY_VENID);
phy_did = xl_phy_readreg(sc, XL_PHY_DEVID);
- if (bootverbose)
- printf("xl%d: found PHY at address %d, ",
- sc->xl_unit, sc->xl_phy_addr);
- if (bootverbose)
- printf("vendor id: %x device id: %x\n",
- phy_vid, phy_did);
- p = xl_phys;
- while(p->xl_vid) {
- if (phy_vid == p->xl_vid &&
- (phy_did | 0x000F) == p->xl_did) {
- sc->xl_pinfo = p;
- break;
- }
- p++;
- }
- if (sc->xl_pinfo == NULL)
- sc->xl_pinfo = &xl_phys[PHY_UNKNOWN];
- if (bootverbose)
- printf("xl%d: PHY type: %s\n",
- sc->xl_unit, sc->xl_pinfo->xl_name);
+ sc->xl_hasmii = 1;
}
else {
printf("%s: MII without any phy!\n",
@@ -3250,8 +3175,6 @@ xl_attach(parent, self, aux)
ifmedia_init(&sc->ifmedia, 0, xl_ifmedia_upd, xl_ifmedia_sts);
if (sc->xl_media & XL_MEDIAOPT_BT) {
- if (bootverbose)
- printf("xl%d: found 10baseT\n", sc->xl_unit);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T, 0, NULL);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T|IFM_HDX, 0, NULL);
if (sc->xl_caps & XL_CAPS_FULL_DUPLEX)
@@ -3260,14 +3183,10 @@ xl_attach(parent, self, aux)
}
if (sc->xl_media & XL_MEDIAOPT_AUI) {
- if (bootverbose)
- printf("xl%d: found AUI\n", sc->xl_unit);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_5, 0, NULL);
}
if (sc->xl_media & XL_MEDIAOPT_BNC) {
- if (bootverbose)
- printf("xl%d: found BNC\n", sc->xl_unit);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_2, 0, NULL);
}
@@ -3278,8 +3197,6 @@ xl_attach(parent, self, aux)
* do it and get it over with.
*/
if (sc->xl_media & XL_MEDIAOPT_BTX) {
- if (bootverbose)
- printf("xl%d: found 100baseTX\n", sc->xl_unit);
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_100_TX, 0, NULL);
ifmedia_add(&sc->ifmedia,
@@ -3287,13 +3204,11 @@ xl_attach(parent, self, aux)
if (sc->xl_caps & XL_CAPS_FULL_DUPLEX)
ifmedia_add(&sc->ifmedia,
IFM_ETHER|IFM_100_TX|IFM_FDX, 0, NULL);
- if (sc->xl_pinfo != NULL)
+ if (sc->xl_hasmii != 0)
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_AUTO, 0, NULL);
}
if (sc->xl_media & XL_MEDIAOPT_BFX) {
- if (bootverbose)
- printf("xl%d: found 100baseFX\n", sc->xl_unit);
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_100_FX, 0, NULL);
}
@@ -3303,8 +3218,6 @@ xl_attach(parent, self, aux)
* separately.
*/
if (sc->xl_media & XL_MEDIAOPT_MII || sc->xl_media & XL_MEDIAOPT_BT4) {
- if (bootverbose)
- printf("xl%d: found MII\n", sc->xl_unit);
xl_getmode_mii(sc);
}
diff --git a/sys/dev/pci/if_xlreg.h b/sys/dev/pci/if_xlreg.h
index 044699496fe..7ec58979170 100644
--- a/sys/dev/pci/if_xlreg.h
+++ b/sys/dev/pci/if_xlreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xlreg.h,v 1.9 1999/02/27 23:54:42 jason Exp $ */
+/* $OpenBSD: if_xlreg.h,v 1.10 1999/03/03 22:51:52 jason Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -552,7 +552,7 @@ struct xl_softc {
volatile caddr_t csr; /* pointer to register map */
#endif
struct xl_type *xl_info; /* 3Com adapter info */
- struct xl_type *xl_pinfo; /* phy info */
+ u_int8_t xl_hasmii; /* whether we have mii or not */
u_int8_t xl_unit; /* interface number */
u_int8_t xl_type;
u_int8_t xl_phy_addr; /* PHY address */