# bge(4) constant freeze on BCM5906M



## buganini (Apr 22, 2010)

Hi, I got problem with my bge card
same hardware, same problem as this
http://unix.derkeiler.com/Mailing-Lists/FreeBSD/current/2008-12/msg00309.html
it freezes.


and NetBSD seemed to have the same problem in old version:
http://mail-index.netbsd.org/netbsd-bugs/2008/09/22/msg006124.html
http://cvsweb.netbsd.org/bsdweb.cgi...-type=text/x-cvsweb-markup&only_with_tag=MAIN
http://cvsweb.netbsd.org/bsdweb.cgi...diff?r1=1.153&r2=1.154&only_with_tag=MAIN&f=h

I read if_bge.c, and I don't understand some parts of code:
[line 2583]

```
case BGE_ASICREV_BCM5906:
                sc->bge_flags |= BGE_FLAG_575X_PLUS;
                /* FALLTHROUGH */
/*Should here have a sc->bge_flags |= BGE_FLAG_5705_PLUS; ??*/
        case BGE_ASICREV_BCM5705:
                sc->bge_flags |= BGE_FLAG_5705_PLUS;
                break;
```
[line 2604]

```
if (BGE_IS_5705_PLUS(sc) &&
            !(sc->bge_flags & BGE_FLAG_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;
/*HERE!*/                } else if (sc->bge_asicrev != BGE_ASICREV_BCM5906)
                        sc->bge_flags |= BGE_FLAG_BER_BUG;
        }
```

[line 1497] this seems to match patched source from NetBSD, but ..

```
if (!BGE_IS_5705_PLUS(sc)) {
                CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50);
                CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20);
                CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60);
        } else if (sc->bge_asicrev == BGE_ASICREV_BCM5906) {
                CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
                CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x04);
                CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x10);
        } else {
                CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
                CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x10);
                CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60);
        }
```



About my hardware and system:

Zeta# `dmesg | grep bge`

```
bge0: <Broadcom BCM5906 A2, ASIC rev. 0x00c002> mem 0xf4600000-0xf460ffff irq 17 at device 0.0 on pci7
--skipped--
bge0: watchdog timeout -- resetting
```

Zeta# `pciconf -lv`

```
bge0@pci0:7:0:0:	class=0x020000 card=0x3a2317aa chip=0x171314e4 rev=0x02 hdr=0x00
    vendor     = 'Broadcom Corporation'
    device     = 'Broadcom NetLink (TM) Fast Ethernet (BCM5906m)'
    class      = network
    subclass   = ethernet
```



```
FreeBSD Zeta.twbbs.org 9.0-CURRENT FreeBSD 9.0-CURRENT #3: Thu Apr 15 02:15:38 CST 2010     [email]root@Zeta.twbbs.org[/email]:/usr/obj
/usr/src/sys/ZETA  i386 Zeta
```


----------



## buganini (Apr 22, 2010)

BTW
NetBSD has this:

```
{ BGE_ASICREV_BCM5906,
	  BGE_QUIRK_ONLY_PHY_1|BGE_QUIRK_5705_CORE,
	  "unknown BCM5906" },
```

it has BGE_QUIRK_5705_CORE flag


----------



## DutchDaemon (Apr 23, 2010)

Format your posts next time: Posting and Editing in the FreeBSD Forums


----------



## buganini (Oct 26, 2010)

Finally this is solved in HEAD since r214292.
Great thanks to yongari@


----------

