summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2003-02-05 08:54:36 +0000
committerps <ps@FreeBSD.org>2003-02-05 08:54:36 +0000
commit0b7392dfc18e9b43f895c2c6415e191633ea0107 (patch)
treee59b98fe1ef8178ece08f0bdfefa993081a98395
parent0eca408203af42b507f3bd31ee7949304aa8a26d (diff)
downloadFreeBSD-src-0b7392dfc18e9b43f895c2c6415e191633ea0107.zip
FreeBSD-src-0b7392dfc18e9b43f895c2c6415e191633ea0107.tar.gz
Obtain the media type from the shared memory and only use the eeprom
as a fallback.
-rw-r--r--sys/dev/bge/if_bge.c22
-rw-r--r--sys/dev/bge/if_bgereg.h2
2 files changed, 17 insertions, 7 deletions
diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c
index da701fc..26803b8 100644
--- a/sys/dev/bge/if_bge.c
+++ b/sys/dev/bge/if_bge.c
@@ -1613,14 +1613,22 @@ bge_attach(dev)
/*
* Figure out what sort of media we have by checking the
- * hardware config word in the EEPROM. Note: on some BCM5700
- * cards, this value appears to be unset. If that's the
- * case, we have to rely on identifying the NIC by its PCI
- * subsystem ID, as we do below for the SysKonnect SK-9D41.
+ * hardware config word in the first 32k of NIC internal memory,
+ * or fall back to examining the EEPROM if necessary.
+ * Note: on some BCM5700 cards, this value appears to be unset.
+ * If that's the case, we have to rely on identifying the NIC
+ * by its PCI subsystem ID, as we do below for the SysKonnect
+ * SK-9D41.
*/
- bge_read_eeprom(sc, (caddr_t)&hwcfg,
- BGE_EE_HWCFG_OFFSET, sizeof(hwcfg));
- if ((ntohl(hwcfg) & BGE_HWCFG_MEDIA) == BGE_MEDIA_FIBER)
+ if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) == BGE_MAGIC_NUMBER)
+ hwcfg = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG);
+ else {
+ bge_read_eeprom(sc, (caddr_t)&hwcfg,
+ BGE_EE_HWCFG_OFFSET, sizeof(hwcfg));
+ hwcfg = ntohl(hwcfg);
+ }
+
+ if ((hwcfg & BGE_HWCFG_MEDIA) == BGE_MEDIA_FIBER)
sc->bge_tbi = 1;
/* The SysKonnect SK-9D41 is a 1000baseSX card. */
diff --git a/sys/dev/bge/if_bgereg.h b/sys/dev/bge/if_bgereg.h
index 4d6725c..4057b18 100644
--- a/sys/dev/bge/if_bgereg.h
+++ b/sys/dev/bge/if_bgereg.h
@@ -72,6 +72,8 @@
#define BGE_STATUS_BLOCK 0x00000B00
#define BGE_STATUS_BLOCK_END 0x00000B4F
#define BGE_SOFTWARE_GENCOMM 0x00000B50
+#define BGE_SOFTWARE_GENCOMM_SIG 0x00000B54
+#define BGE_SOFTWARE_GENCOMM_NICCFG 0x00000B58
#define BGE_SOFTWARE_GENCOMM_END 0x00000FFF
#define BGE_UNMAPPED 0x00001000
#define BGE_UNMAPPED_END 0x00001FFF
OpenPOWER on IntegriCloud