NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

re: port-i386/40677: Some fxp network cards no longer work




stephan and yamt,

could you please try this patch?  it incorporates the ideas from
stephans patch with other feedback i've had, but i can't test this
myself.

thanks.


.mrg.


Index: pci/if_fxp_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_fxp_pci.c,v
retrieving revision 1.61
diff -p -u -r1.61 if_fxp_pci.c
--- pci/if_fxp_pci.c    18 Jan 2009 10:37:04 -0000      1.61
+++ pci/if_fxp_pci.c    19 Feb 2009 07:56:17 -0000
@@ -348,7 +348,7 @@ fxp_pci_attach(device_t parent, device_t
                        chipname = "i82559S Ethernet";
                if (sc->sc_rev >= FXP_REV_82550) {
                        chipname = "i82550 Ethernet";
-                       sc->sc_flags |= FXPF_EXT_RFA|FXPF_IPCB;
+                       sc->sc_flags |= FXPF_EXT_RFA;
                }
 
                /*
@@ -372,17 +372,19 @@ fxp_pci_attach(device_t parent, device_t
        case PCI_PRODUCT_INTEL_82562EH_HPNA_1:
        case PCI_PRODUCT_INTEL_82562EH_HPNA_2:
        case PCI_PRODUCT_INTEL_PRO_100_VM_2:
-               aprint_normal(": %s, rev %d\n", fpp->fpp_name, sc->sc_rev);
-               sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB;
                /*
                 * The ICH-2 and ICH-3 have the "resume bug".
                 */
                sc->sc_flags |= FXPF_HAS_RESUME_BUG;
-               break;
+               /* FALLTHROUGH */
 
        default:
                aprint_normal(": %s, rev %d\n", fpp->fpp_name, sc->sc_rev);
-               sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB|FXPF_EXT_RFA|FXPF_IPCB;
+               if (sc->sc_rev >= FXP_REV_82558_A4)
+                       sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB;
+               if (sc->sc_rev == FXP_REV_82550 || sc->sc_rev == 
FXP_REV_82550_C)
+                       sc->sc_flags |= FXPF_EXT_RFA;
+
                break;
        }
 
Index: ic/i82557.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/i82557.c,v
retrieving revision 1.122
diff -p -u -r1.122 i82557.c
--- ic/i82557.c 18 Jan 2009 10:37:04 -0000      1.122
+++ ic/i82557.c 19 Feb 2009 07:56:17 -0000
@@ -268,7 +268,7 @@ fxp_attach(struct fxp_softc *sc)
         * too, but that's already enabled by the code above.
         * Be careful to do this only on the right devices.
         */
-       if (sc->sc_flags & FXPF_IPCB)
+       if (sc->sc_flags & FXPF_EXT_TXCB)
                sc->sc_txcmd = htole16(FXP_CB_COMMAND_IPCBXMIT);
        else
                sc->sc_txcmd = htole16(FXP_CB_COMMAND_XMIT);
@@ -324,7 +324,7 @@ fxp_attach(struct fxp_softc *sc)
         */
        for (i = 0; i < FXP_NTXCB; i++) {
                if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES,
-                   (sc->sc_flags & FXPF_IPCB) ? FXP_IPCB_NTXSEG : FXP_NTXSEG,
+                   (sc->sc_flags & FXPF_EXT_TXCB) ? FXP_IPCB_NTXSEG : 
FXP_NTXSEG,
                    MCLBYTES, 0, 0, &FXP_DSTX(sc, i)->txs_dmamap)) != 0) {
                        aprint_error_dev(sc->sc_dev,
                            "unable to create tx DMA map %d, error = %d\n",
@@ -374,7 +374,7 @@ fxp_attach(struct fxp_softc *sc)
        ifp->if_stop = fxp_stop;
        IFQ_SET_READY(&ifp->if_snd);
 
-       if (sc->sc_flags & FXPF_IPCB) {
+       if (sc->sc_flags & FXPF_EXT_TXCB) {
                KASSERT(sc->sc_flags & FXPF_EXT_RFA); /* we have both or none */
                /*
                 * IFCAP_CSUM_IPv4_Tx seems to have a problem,
@@ -896,7 +896,7 @@ fxp_start(struct ifnet *ifp)
                tbdp = txd->txd_tbd;
                len = m0->m_pkthdr.len;
                nsegs = dmamap->dm_nsegs;
-               if (sc->sc_flags & FXPF_IPCB)
+               if (sc->sc_flags & FXPF_EXT_TXCB)
                        tbdp++;
                for (seg = 0; seg < nsegs; seg++) {
                        tbdp[seg].tb_addr =
@@ -940,7 +940,7 @@ fxp_start(struct ifnet *ifp)
                txd->txd_txcb.tbd_number = nsegs;
 
                KASSERT((csum_flags & (M_CSUM_TCPv6 | M_CSUM_UDPv6)) == 0);
-               if (sc->sc_flags & FXPF_IPCB) {
+               if (sc->sc_flags & FXPF_EXT_TXCB) {
                        struct m_tag *vtag;
                        struct fxp_ipcb *ipcb;
                        /*
Index: ic/i82557reg.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/i82557reg.h,v
retrieving revision 1.21
diff -p -u -r1.21 i82557reg.h
--- ic/i82557reg.h      3 Dec 2008 15:34:38 -0000       1.21
+++ ic/i82557reg.h      19 Feb 2009 07:56:17 -0000
@@ -370,7 +370,7 @@ struct fxp_tbd {
 #define FXP_CB_STATUS_C                0x8000
 
 /* commands */
-#define FXP_CB_COMMAND_CMD     0x0007  /* XXX how about FXPF_IPCB case? */
+#define FXP_CB_COMMAND_CMD     0x0007
 #define FXP_CB_COMMAND_NOP     0x0
 #define FXP_CB_COMMAND_IAS     0x1
 #define FXP_CB_COMMAND_CONFIG  0x2
Index: ic/i82557var.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/i82557var.h,v
retrieving revision 1.42
diff -p -u -r1.42 i82557var.h
--- ic/i82557var.h      18 Jan 2009 10:37:04 -0000      1.42
+++ ic/i82557var.h      19 Feb 2009 07:56:17 -0000
@@ -222,7 +222,6 @@ struct fxp_softc {
 #define        FXPF_EXT_TXCB           0x0080  /* enable extended TxCB */
 #define        FXPF_UCODE_LOADED       0x0100  /* microcode is loaded */
 #define        FXPF_EXT_RFA            0x0200  /* enable extended RFD */
-#define        FXPF_IPCB               0x0400  /* use IPCB */
 #define        FXPF_RECV_WORKAROUND    0x0800  /* receiver lock-up workaround 
*/
 #define        FXPF_FC                 0x1000  /* has flow control */
 
Index: cardbus/if_fxp_cardbus.c
===================================================================
RCS file: /cvsroot/src/sys/dev/cardbus/if_fxp_cardbus.c,v
retrieving revision 1.35
diff -p -u -r1.35 if_fxp_cardbus.c
--- cardbus/if_fxp_cardbus.c    18 Jan 2009 10:37:03 -0000      1.35
+++ cardbus/if_fxp_cardbus.c    19 Feb 2009 07:56:17 -0000
@@ -168,7 +168,7 @@ fxp_cardbus_attach(struct device *parent
        if (sc->sc_rev >= FXP_REV_82558_A4)
                sc->sc_flags |= FXPF_FC|FXPF_EXT_TXCB;
        if (sc->sc_rev >= FXP_REV_82550)
-               sc->sc_flags |= FXPF_EXT_RFA|FXPF_IPCB;
+               sc->sc_flags |= FXPF_EXT_RFA;
 
        sc->sc_dmat = ca->ca_dmat;
        sc->sc_enable = fxp_cardbus_enable;


Home | Main Index | Thread Index | Old Index