aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPyun YongHyeon <yongari@FreeBSD.org>2010-10-05 23:03:48 +0000
committerPyun YongHyeon <yongari@FreeBSD.org>2010-10-05 23:03:48 +0000
commit757402fba02f8450cad84ad2c016e6af2a03c5a0 (patch)
tree4d81d30535bb9c4bb8e85f58b6eddc1f61ca48b8
parent923974ab033d04b38402f7ff85e51e874211079e (diff)
downloadsrc-757402fba02f8450cad84ad2c016e6af2a03c5a0.tar.gz
src-757402fba02f8450cad84ad2c016e6af2a03c5a0.zip
Separate common flags into controller specific and PHY related
flags. There should be no functional changes. This change will make it easy to add more quirk/flags in future. Reviewed by: davidch
Notes
Notes: svn path=/head/; revision=213464
-rw-r--r--sys/dev/bge/if_bge.c22
-rw-r--r--sys/dev/bge/if_bgereg.h35
-rw-r--r--sys/dev/mii/brgphy.c16
3 files changed, 37 insertions, 36 deletions
diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c
index 317bcd25869e..d7cba4b95585 100644
--- a/sys/dev/bge/if_bge.c
+++ b/sys/dev/bge/if_bge.c
@@ -2510,7 +2510,7 @@ bge_attach(device_t dev)
sc->bge_asicrev != BGE_ASICREV_BCM5906 &&
sc->bge_chipid != BGE_CHIPID_BCM5705_A0 &&
sc->bge_chipid != BGE_CHIPID_BCM5705_A1)
- sc->bge_flags |= BGE_FLAG_WIRESPEED;
+ sc->bge_phy_flags |= BGE_PHY_WIRESPEED;
if (bge_has_eaddr(sc))
sc->bge_flags |= BGE_FLAG_EADDR;
@@ -2547,30 +2547,30 @@ bge_attach(device_t dev)
break;
}
- /* Set various bug flags. */
+ /* Set various PHY bug flags. */
if (sc->bge_chipid == BGE_CHIPID_BCM5701_A0 ||
sc->bge_chipid == BGE_CHIPID_BCM5701_B0)
- sc->bge_flags |= BGE_FLAG_CRC_BUG;
+ sc->bge_phy_flags |= BGE_PHY_CRC_BUG;
if (sc->bge_chiprev == BGE_CHIPREV_5703_AX ||
sc->bge_chiprev == BGE_CHIPREV_5704_AX)
- sc->bge_flags |= BGE_FLAG_ADC_BUG;
+ sc->bge_phy_flags |= BGE_PHY_ADC_BUG;
if (sc->bge_chipid == BGE_CHIPID_BCM5704_A0)
- sc->bge_flags |= BGE_FLAG_5704_A0_BUG;
+ sc->bge_phy_flags |= BGE_PHY_5704_A0_BUG;
if (pci_get_subvendor(dev) == DELL_VENDORID)
- sc->bge_flags |= BGE_FLAG_NO_3LED;
+ sc->bge_phy_flags |= BGE_PHY_NO_3LED;
if (pci_get_device(dev) == BCOM_DEVICEID_BCM5755M)
- sc->bge_flags |= BGE_FLAG_ADJUST_TRIM;
+ sc->bge_phy_flags |= BGE_PHY_ADJUST_TRIM;
if (BGE_IS_5705_PLUS(sc) &&
- !(sc->bge_flags & BGE_FLAG_ADJUST_TRIM)) {
+ !(sc->bge_phy_flags & BGE_PHY_ADJUST_TRIM)) {
if (sc->bge_asicrev == BGE_ASICREV_BCM5755 ||
sc->bge_asicrev == BGE_ASICREV_BCM5761 ||
sc->bge_asicrev == BGE_ASICREV_BCM5784 ||
sc->bge_asicrev == BGE_ASICREV_BCM5787) {
if (pci_get_device(dev) != BCOM_DEVICEID_BCM5722 &&
pci_get_device(dev) != BCOM_DEVICEID_BCM5756)
- sc->bge_flags |= BGE_FLAG_JITTER_BUG;
+ sc->bge_phy_flags |= BGE_PHY_JITTER_BUG;
} else if (sc->bge_asicrev != BGE_ASICREV_BCM5906)
- sc->bge_flags |= BGE_FLAG_BER_BUG;
+ sc->bge_phy_flags |= BGE_PHY_BER_BUG;
}
/*
@@ -5353,7 +5353,7 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARGS)
printf(" - PCI-X Bus\n");
if (sc->bge_flags & BGE_FLAG_PCIE)
printf(" - PCI Express Bus\n");
- if (sc->bge_flags & BGE_FLAG_NO_3LED)
+ if (sc->bge_phy_flags & BGE_FLAG_NO_3LED)
printf(" - No 3 LEDs\n");
if (sc->bge_flags & BGE_FLAG_RX_ALIGNBUG)
printf(" - RX Alignment Bug\n");
diff --git a/sys/dev/bge/if_bgereg.h b/sys/dev/bge/if_bgereg.h
index 87abca8f2769..b17ff5a8fb65 100644
--- a/sys/dev/bge/if_bgereg.h
+++ b/sys/dev/bge/if_bgereg.h
@@ -2663,29 +2663,30 @@ struct bge_softc {
uint32_t bge_flags;
#define BGE_FLAG_TBI 0x00000001
#define BGE_FLAG_JUMBO 0x00000002
-#define BGE_FLAG_WIRESPEED 0x00000004
#define BGE_FLAG_EADDR 0x00000008
#define BGE_FLAG_MII_SERDES 0x00000010
#define BGE_FLAG_MSI 0x00000100
#define BGE_FLAG_PCIX 0x00000200
#define BGE_FLAG_PCIE 0x00000400
#define BGE_FLAG_TSO 0x00000800
-#define BGE_FLAG_5700_FAMILY 0x00001000
-#define BGE_FLAG_5705_PLUS 0x00002000
-#define BGE_FLAG_5714_FAMILY 0x00004000
-#define BGE_FLAG_575X_PLUS 0x00008000
-#define BGE_FLAG_5755_PLUS 0x00010000
-#define BGE_FLAG_40BIT_BUG 0x00020000
-#define BGE_FLAG_4G_BNDRY_BUG 0x00040000
-#define BGE_FLAG_RX_ALIGNBUG 0x00100000
-#define BGE_FLAG_NO_3LED 0x00200000
-#define BGE_FLAG_ADC_BUG 0x00400000
-#define BGE_FLAG_5704_A0_BUG 0x00800000
-#define BGE_FLAG_JITTER_BUG 0x01000000
-#define BGE_FLAG_BER_BUG 0x02000000
-#define BGE_FLAG_ADJUST_TRIM 0x04000000
-#define BGE_FLAG_CRC_BUG 0x08000000
-#define BGE_FLAG_5788 0x20000000
+#define BGE_FLAG_5700_FAMILY 0x00010000
+#define BGE_FLAG_5705_PLUS 0x00020000
+#define BGE_FLAG_5714_FAMILY 0x00040000
+#define BGE_FLAG_575X_PLUS 0x00080000
+#define BGE_FLAG_5755_PLUS 0x00100000
+#define BGE_FLAG_5788 0x00200000
+#define BGE_FLAG_40BIT_BUG 0x01000000
+#define BGE_FLAG_4G_BNDRY_BUG 0x02000000
+#define BGE_FLAG_RX_ALIGNBUG 0x04000000
+ uint32_t bge_phy_flags;
+#define BGE_PHY_WIRESPEED 0x00000001
+#define BGE_PHY_ADC_BUG 0x00000002
+#define BGE_PHY_5704_A0_BUG 0x00000004
+#define BGE_PHY_JITTER_BUG 0x00000008
+#define BGE_PHY_BER_BUG 0x00000010
+#define BGE_PHY_ADJUST_TRIM 0x00000020
+#define BGE_PHY_CRC_BUG 0x00000040
+#define BGE_PHY_NO_3LED 0x00000080
uint32_t bge_chipid;
uint32_t bge_asicrev;
uint32_t bge_chiprev;
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c
index 181798ec630b..44d92a754554 100644
--- a/sys/dev/mii/brgphy.c
+++ b/sys/dev/mii/brgphy.c
@@ -1025,26 +1025,26 @@ brgphy_reset(struct mii_softc *sc)
/* Handle any bge (NetXtreme/NetLink) workarounds. */
if (bge_sc) {
/* Fix up various bugs */
- if (bge_sc->bge_flags & BGE_FLAG_5704_A0_BUG)
+ if (bge_sc->bge_phy_flags & BGE_PHY_5704_A0_BUG)
brgphy_fixup_5704_a0_bug(sc);
- if (bge_sc->bge_flags & BGE_FLAG_ADC_BUG)
+ if (bge_sc->bge_phy_flags & BGE_PHY_ADC_BUG)
brgphy_fixup_adc_bug(sc);
- if (bge_sc->bge_flags & BGE_FLAG_ADJUST_TRIM)
+ if (bge_sc->bge_phy_flags & BGE_PHY_ADJUST_TRIM)
brgphy_fixup_adjust_trim(sc);
- if (bge_sc->bge_flags & BGE_FLAG_BER_BUG)
+ if (bge_sc->bge_phy_flags & BGE_PHY_BER_BUG)
brgphy_fixup_ber_bug(sc);
- if (bge_sc->bge_flags & BGE_FLAG_CRC_BUG)
+ if (bge_sc->bge_phy_flags & BGE_PHY_CRC_BUG)
brgphy_fixup_crc_bug(sc);
- if (bge_sc->bge_flags & BGE_FLAG_JITTER_BUG)
+ if (bge_sc->bge_phy_flags & BGE_PHY_JITTER_BUG)
brgphy_fixup_jitter_bug(sc);
brgphy_jumbo_settings(sc, ifp->if_mtu);
- if (bge_sc->bge_flags & BGE_FLAG_WIRESPEED)
+ if (bge_sc->bge_phy_flags & BGE_PHY_WIRESPEED)
brgphy_ethernet_wirespeed(sc);
/* Enable Link LED on Dell boxes */
- if (bge_sc->bge_flags & BGE_FLAG_NO_3LED) {
+ if (bge_sc->bge_phy_flags & BGE_PHY_NO_3LED) {
PHY_WRITE(sc, BRGPHY_MII_PHY_EXTCTL,
PHY_READ(sc, BRGPHY_MII_PHY_EXTCTL) &
~BRGPHY_PHY_EXTCTL_3_LED);