summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2000-03-11 05:20:56 +0000
committermsmith <msmith@FreeBSD.org>2000-03-11 05:20:56 +0000
commitfc305a1974a26ba6fe9640efecfc99cbbb8d21a1 (patch)
tree704413176a666ad12adfa1a2f2cf054e379a6901 /sys
parent2bf7fb4443657c73135a45e4c526e1315a86d1db (diff)
downloadFreeBSD-src-fc305a1974a26ba6fe9640efecfc99cbbb8d21a1.zip
FreeBSD-src-fc305a1974a26ba6fe9640efecfc99cbbb8d21a1.tar.gz
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
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/dc/if_dc.c40
-rw-r--r--sys/dev/dc/if_dcreg.h3
-rw-r--r--sys/pci/if_dc.c40
-rw-r--r--sys/pci/if_dcreg.h3
4 files changed, 86 insertions, 0 deletions
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;
diff --git a/sys/dev/dc/if_dcreg.h b/sys/dev/dc/if_dcreg.h
index e358c4d..9620e10 100644
--- a/sys/dev/dc/if_dcreg.h
+++ b/sys/dev/dc/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
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
OpenPOWER on IntegriCloud