From owner-freebsd-net@FreeBSD.ORG  Mon Feb  9 18:41:34 2009
Return-Path: <owner-freebsd-net@FreeBSD.ORG>
Delivered-To: freebsd-net@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0D5CE106566C
	for <freebsd-net@freebsd.org>; Mon,  9 Feb 2009 18:41:34 +0000 (UTC)
	(envelope-from helen.zhang@bluecoat.com)
Received: from whisker.bluecoat.com (whisker.bluecoat.com [216.52.23.28])
	by mx1.freebsd.org (Postfix) with ESMTP id E3C308FC1D
	for <freebsd-net@freebsd.org>; Mon,  9 Feb 2009 18:41:33 +0000 (UTC)
	(envelope-from helen.zhang@bluecoat.com)
Received: from bcs-mail6.internal.cacheflow.com ([10.2.2.69])
	by whisker.bluecoat.com (8.14.2/8.14.2) with ESMTP id n19IReZH019307
	for <freebsd-net@freebsd.org>; Mon, 9 Feb 2009 10:27:40 -0800 (PST)
Received: from bcs-mail04.internal.cacheflow.com ([10.2.2.56]) by
	bcs-mail6.internal.cacheflow.com with Microsoft
	SMTPSVC(6.0.3790.3959); Mon, 9 Feb 2009 10:27:35 -0800
X-MimeOLE: Produced By Microsoft Exchange V6.5
Content-class: urn:content-classes:message
MIME-Version: 1.0
Date: Mon, 9 Feb 2009 10:27:35 -0800
Message-ID: <9CFA8139F7106843B28F9E6FB1FF4BBE0D0117@bcs-mail04.internal.cacheflow.com>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Anyone working on the FreeBSD driver for broadcom 5784M Gige
	chip?
Thread-Index: AcmK5BQ4030rsnpDQR2er4pUV5iClw==
From: "Zhang, Helen" <helen.zhang@bluecoat.com>
To: <freebsd-net@freebsd.org>
X-OriginalArrivalTime: 09 Feb 2009 18:27:35.0694 (UTC)
	FILETIME=[1471AAE0:01C98AE4]
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.5
Subject: Anyone working on the FreeBSD driver for broadcom 5784M Gige chip?
X-BeenThere: freebsd-net@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Networking and TCP/IP with FreeBSD <freebsd-net.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
	<mailto:freebsd-net-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-net>
List-Post: <mailto:freebsd-net@freebsd.org>
List-Help: <mailto:freebsd-net-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-net>,
	<mailto:freebsd-net-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 09 Feb 2009 18:41:34 -0000

Hi, there:

=20

I'm new to FreeBSD community and this is my first email to the mailing
group.

=20

Recently I'm working on Broadcom 5784M Gige driver. My code base is
close to FreeBSD,=20

but FreeBSD bge driver doesn't support the chip yet. The linux driver
supports the chip. =20

I'm wondering whether anyone is working or plans to work on to port the
linux code to=20

FreeBSD base. If so, I hope we can share some information together.
Thanks.

=20

Another thing, I found one dead loop in current src/sys/dev/bge/if_bge.c
(both 216/217=20

revisions): around line 2682,  if mii_phy_probe( ) fails, the code will
go back to again (4 lines=20

back). Variable trys will reset to 0 every time, so the (trys++<4)
condition is forever false.=20

=20

I don't know how to report the bug to freebsd Community yet. So I just
attach the related=20

code below. The fix is simple: just move "trys=3D0" line before again:

=20

Thanks and best wishes to everyone!

=20

-Helen

=20

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

src/sys/dev/bge/if_bge.c: around line 2676

=20

                BGE_CLRBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP);

again:

                bge_asf_driver_up(sc);

=20

                trys =3D 0;

                if (mii_phy_probe(dev, &sc->bge_miibus,    <<<<<< line
2682

                    bge_ifmedia_upd, bge_ifmedia_sts)) {

                        if (trys++ < 4) {

                                device_printf(sc->bge_dev, "Try
again\n");

                                bge_miibus_writereg(sc->bge_dev, 1,
MII_BMCR,

                                    BMCR_RESET);

                                goto again;

                        }

=20

                        device_printf(sc->bge_dev, "MII without any
PHY!\n");

                        error =3D ENXIO;

                        goto fail;

                }

=20

=20