Subject: Re: rtl80x9_init_media
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: Ignatios Souvatzis <is@jocelyn.rhein.de>
List: tech-net
Date: 02/29/2000 23:02:57
--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
On Tue, Feb 29, 2000 at 12:59:16PM -0800, Jason Thorpe wrote:
> On Tue, 29 Feb 2000 21:21:59 +0100
> Ignatios Souvatzis <is@jocelyn.rhein.de> wrote:
>
> > printf("%s: 10base2, 10baseT, 10baseT-FDX, auto, default auto\n",
> >
> > (the default is hardwired).
> >
> > Shouldn't this rather default to the EEPROM settings, which are read (by the
> > hardware) into the config2 and config3 registers at chip reset time?
>
> Probably.
Anybody want to review this? I wont be able to do much testing tonight.
(Ok, so I dont read in the eeprom, but read the config2/3 registers. As long
as this is only needed once and we don't clobber the config registers first,
this should be ok, right?)
-is
--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=thediff
Index: rtl80x9.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/rtl80x9.c,v
retrieving revision 1.2
diff -u -r1.2 rtl80x9.c
--- rtl80x9.c 1998/11/08 22:02:25 1.2
+++ rtl80x9.c 2000/02/29 21:56:42
@@ -68,6 +68,8 @@
#include <dev/ic/rtl80x9reg.h>
#include <dev/ic/rtl80x9var.h>
+void rtl80x9_mediastatus_internal __P((struct dp8390_softc *, int *));
+
int
rtl80x9_mediachange(dsc)
struct dp8390_softc *dsc;
@@ -83,9 +85,9 @@
}
void
-rtl80x9_mediastatus(sc, ifmr)
+rtl80x9_mediastatus_internal(sc, curmed)
struct dp8390_softc *sc;
- struct ifmediareq *ifmr;
+ int *curmed;
{
struct ifnet *ifp = &sc->sc_ec.ec_if;
u_int8_t cr_proto = sc->cr_proto |
@@ -101,12 +103,12 @@
if (NIC_GET(sc->sc_regt, sc->sc_regh, NERTL_RTL3_CONFIG0) &
RTL3_CONFIG0_BNC)
- ifmr->ifm_active = IFM_ETHER|IFM_10_2;
+ *curmed = IFM_ETHER|IFM_10_2;
else {
- ifmr->ifm_active = IFM_ETHER|IFM_10_T;
+ *curmed = IFM_ETHER|IFM_10_T;
if (NIC_GET(sc->sc_regt, sc->sc_regh, NERTL_RTL3_CONFIG3) &
RTL3_CONFIG3_FUDUP)
- ifmr->ifm_active |= IFM_FDX;
+ *curmed |= IFM_FDX;
}
/* Set NIC to page 0 registers. */
@@ -114,6 +116,14 @@
}
void
+rtl80x9_mediastatus(sc, ifmr)
+ struct dp8390_softc *sc;
+ struct ifmediareq *ifmr;
+{
+ rtl80x9_mediastatus_internal(sc, &ifmr->ifm_active);
+}
+
+void
rtl80x9_init_card(sc)
struct dp8390_softc *sc;
{
@@ -168,10 +178,20 @@
IFM_ETHER|IFM_10_2,
};
- printf("%s: 10base2, 10baseT, 10baseT-FDX, auto, default auto\n",
- sc->sc_dev.dv_xname);
-
*mediap = rtl80x9_media;
*nmediap = sizeof(rtl80x9_media) / sizeof(rtl80x9_media[0]);
- *defmediap = IFM_ETHER|IFM_AUTO;
+
+ rtl80x9_mediastatus_internal(sc, defmediap);
+
+ printf("%s: 10base2, 10baseT, 10baseT-FDX, auto, default ",
+ sc->sc_dev.dv_xname);
+
+ if (*defmediap & IFM_AUTO)
+ printf("auto\n");
+ else if (*defmediap & IFM_10_2)
+ printf("10base2\n");
+ else if (*defmediap & IFM_FDX)
+ printf("10baseT-FDX\n");
+ else
+ printf("10baseT\n");
}
--azLHFNyN32YCQGCU--