Author: yongari
Date: Tue Oct  5 23:03:48 2010
New Revision: 213464
URL: http://svn.freebsd.org/changeset/base/213464

Log:
  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

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bge/if_bgereg.h
  head/sys/dev/mii/brgphy.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c   Tue Oct  5 22:26:01 2010        (r213463)
+++ head/sys/dev/bge/if_bge.c   Tue Oct  5 23:03:48 2010        (r213464)
@@ -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_ARG
                        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");

Modified: head/sys/dev/bge/if_bgereg.h
==============================================================================
--- head/sys/dev/bge/if_bgereg.h        Tue Oct  5 22:26:01 2010        
(r213463)
+++ head/sys/dev/bge/if_bgereg.h        Tue Oct  5 23:03:48 2010        
(r213464)
@@ -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;

Modified: head/sys/dev/mii/brgphy.c
==============================================================================
--- head/sys/dev/mii/brgphy.c   Tue Oct  5 22:26:01 2010        (r213463)
+++ head/sys/dev/mii/brgphy.c   Tue Oct  5 23:03:48 2010        (r213464)
@@ -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);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to