bge: Workaround mbox write reordering for PCI-X devices
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 2 Jul 2012 08:20:05 +0000 (16:20 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 2 Jul 2012 08:46:02 +0000 (16:46 +0800)
Add per device tunable hw.bgeX.mbox_reorder to control this; it is
off by default.

Based-on: FreeBSD 232848

sys/dev/netif/bge/if_bge.c
sys/dev/netif/bge/if_bgereg.h

index 56cc589..c99ffef 100644 (file)
@@ -497,6 +497,8 @@ bge_writembx(struct bge_softc *sc, int off, int val)
                off += BGE_LPMBX_IRQ0_HI - BGE_MBX_IRQ0_HI;
 
        CSR_WRITE_4(sc, off, val);
+       if (sc->bge_mbox_reorder)
+               CSR_READ_4(sc, off);
 }
 
 static uint8_t
@@ -2155,6 +2157,8 @@ bge_attach(device_t dev)
                    BGE_PCISTATE_PCI_BUSMODE) == 0) {
                        sc->bge_flags |= BGE_FLAG_PCIX;
                        sc->bge_pcixcap = pci_get_pcixcap_ptr(sc->bge_dev);
+                       sc->bge_mbox_reorder = device_getenv_int(sc->bge_dev,
+                           "mbox_reorder", 0);
                }
        }
 
index 43fc2a9..4d585f8 100644 (file)
@@ -2553,6 +2553,7 @@ struct bge_softc {
        uint32_t                bge_tx_buf_ratio;
        uint32_t                bge_mi_mode;
        int                     bge_force_defrag;
+       int                     bge_mbox_reorder;
        int                     bge_if_flags;
        int                     bge_txcnt;
        int                     bge_link;