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/pci/if_dc.c | 40 ++++++++++++++++++++++++++++++++++++++++ sys/pci/if_dcreg.h | 3 +++ 2 files changed, 43 insertions(+) (limited to 'sys/pci') diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c index c634c3a..d25727c 100644 --- a/sys/pci/if_dc.c +++ b/sys/pci/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; diff --git a/sys/pci/if_dcreg.h b/sys/pci/if_dcreg.h index e358c4d..9620e10 100644 --- a/sys/pci/if_dcreg.h +++ b/sys/pci/if_dcreg.h @@ -655,6 +655,9 @@ struct dc_softc { struct dc_list_data *dc_ldata; struct dc_chain_data dc_cdata; struct callout_handle dc_stat_ch; +#ifdef __alpha__ + int dc_srm_media; +#endif }; #define DC_TX_POLL 0x00000001 -- cgit v1.1