From fc305a1974a26ba6fe9640efecfc99cbbb8d21a1 Mon Sep 17 00:00:00 2001 From: msmith Date: Sat, 11 Mar 2000 05:20:56 +0000 Subject: Teach the 'dc' driver how to pick up settings left over by the SRM on alpha systems. This is an expedient if not entirely elegant solution to the problem. Submitted by: gallatin Approved by: jkh --- sys/dev/dc/if_dc.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'sys/dev/dc/if_dc.c') diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index c634c3a..d25727c 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -1726,6 +1726,33 @@ static int dc_attach(dev) bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); +#ifdef __alpha__ + sc->dc_srm_media = 0; + + /* Remember the SRM console media setting */ + if (DC_IS_INTEL(sc)) { + command = pci_read_config(dev, DC_PCI_CFDD, 4); + command &= ~(DC_CFDD_SNOOZE_MODE|DC_CFDD_SLEEP_MODE); + switch ((command >> 8) & 0xff) { + case 3: + sc->dc_srm_media = IFM_10_T; + break; + case 4: + sc->dc_srm_media = IFM_10_T | IFM_FDX; + break; + case 5: + sc->dc_srm_media = IFM_100_TX; + break; + case 6: + sc->dc_srm_media = IFM_100_TX | IFM_FDX; + break; + } + if (sc->dc_srm_media) + sc->dc_srm_media |= IFM_ACTIVE | IFM_ETHER; + } +#endif + + fail: splx(s); @@ -2690,6 +2717,15 @@ static void dc_init(xsc) sc->dc_stat_ch = timeout(dc_tick, sc, hz); +#ifdef __alpha__ + if(sc->dc_srm_media) { + struct ifreq ifr; + + ifr.ifr_media = sc->dc_srm_media; + ifmedia_ioctl(ifp, &ifr, &mii->mii_media, SIOCSIFMEDIA); + sc->dc_srm_media = 0; + } +#endif return; } @@ -2793,6 +2829,10 @@ static int dc_ioctl(ifp, command, data) case SIOCSIFMEDIA: mii = device_get_softc(sc->dc_miibus); error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); +#ifdef __alpha__ + if (sc->dc_srm_media) + sc->dc_srm_media = 0; +#endif break; default: error = EINVAL; -- cgit v1.1