From owner-freebsd-embedded@FreeBSD.ORG Sun Nov 13 23:30:11 2011 Return-Path: Delivered-To: embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F39C106564A for ; Sun, 13 Nov 2011 23:30:11 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 98EB18FC08 for ; Sun, 13 Nov 2011 23:30:10 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id pADMx7Ta077732; Sun, 13 Nov 2011 23:59:07 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id pADMx7BK077731; Sun, 13 Nov 2011 23:59:07 +0100 (CET) (envelope-from marius) Date: Sun, 13 Nov 2011 23:59:07 +0100 From: Marius Strobl To: Aleksandr Rybalko Message-ID: <20111113225907.GS93221@alchemy.franken.de> References: <20111110014904.0e8caf2c.ray@ddteam.net> <20111111004514.04bc27be.ray@ddteam.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111111004514.04bc27be.ray@ddteam.net> User-Agent: Mutt/1.4.2.3i Cc: embedded@freebsd.org Subject: Re: Ethernet switch framework X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Nov 2011 23:30:11 -0000 On Fri, Nov 11, 2011 at 12:45:14AM +0200, Aleksandr Rybalko wrote: > Hi embedders, > > Invite Marius to discussion if Marius don't have objections :) > > On Thu, 10 Nov 2011 08:17:46 -0800 > Adrian Chadd wrote: > > > Hi! > > > > This is great. Between you, gonzo@ and loos, I think we finally will > > have something to throw into -HEAD. > > > > The miibus changes though - why did you need those? Can you run them > > by marius@ and see what he thinks? > > > > > > Adrian > > Copy miibus diff here to easily scope it > Index: mii.c > =================================================================== > --- mii.c (revision 227410) > +++ mii.c (working copy) > @@ -310,7 +310,13 @@ > struct mii_attach_args ma, *args; > device_t *children, phy; > int bmsr, first, i, nchildren, offset, phymax, phymin, rv; > + uint32_t phymask; > + const char *value; > + char *key; > > + phymask = 0xfffffffful; > + key = "phyXX"; > + > if (phyloc != MII_PHY_ANY && offloc != MII_OFFSET_ANY) { > printf("%s: phyloc and offloc specified\n", __func__); > return (EINVAL); > @@ -366,6 +372,9 @@ > > ma.mii_capmask = capmask; > > + resource_int_value(device_get_name(*miibus), device_get_unit > (*miibus), > + "phymask", &phymask); > + > phy = NULL; > offset = 0; > for (ma.mii_phyno = phymin; ma.mii_phyno <= phymax; > ma.mii_phyno++) { @@ -390,6 +399,26 @@ > } > > /* > + * If phymask don't have corresponding bit set, then > this PHY > + * id marked as muted, skip to next id. > + */ > + if (!(phymask & (1 << ma.mii_phyno))) > + continue; > + > + /* > + * Check if we have hinted driver. If so, attach it. > + */ > + value = NULL; > + sprintf(key, "phy%d", ma.mii_phyno); > + if (resource_string_value(device_get_name(*miibus), > + device_get_unit(*miibus), key, &value) == 0) { > + > + ma.mii_id1 = 0; > + ma.mii_id2 = 0; > + goto attach_hinted; > + } > + > + /* > * Check to see if there is a PHY at this address. > Note, > * many braindead PHYs report 0/0 in their ID > registers, > * so we test for media in the BMSR. > @@ -416,13 +445,14 @@ > ma.mii_id1 = MIIBUS_READREG(dev, ma.mii_phyno,MII_PHYIDR1); > ma.mii_id2 = MIIBUS_READREG(dev, ma.mii_phyno,MII_PHYIDR2); > +attach_hinted: > ma.mii_offset = offset; > args = malloc(sizeof(struct mii_attach_args), M_DEVBUF, > M_NOWAIT); > if (args == NULL) > goto skip; > bcopy((char *)&ma, (char *)args, sizeof(ma)); > - phy = device_add_child(*miibus, NULL, -1); > + phy = device_add_child(*miibus, value, -1); > if (phy == NULL) { > free(args, M_DEVBUF); > goto skip; > =================================================================== > > So this diff have to parts: > > 1. cosmetic one - fetching and apply phymask from hints. Why I need it? > Because switches like Atheros AR8x16 map their registers into MDIO > space. So if we not filter it, we will have random set of PHYs on > miibusX. Mostly ukphy, but even ukphy making read to PHY registers and > this may corrupt switch driver data (registers which Read/Clear). > > 2. Second is easy and cheap way to pre-assign phy driver to > some PHY ID on MDIO. I need it because > a) some switches have no ID in MII_PHYIDR1 and MII_PHYIDR2 > registers (BCM5325, AR8x16); > b) in cases when AR8x16 on MDIO attached to many NIC's, after > first instance of driver initialize switch, second miibus instance > don't found any PHY's. > c) D-Link DSR-500[1000] (Cavium Octeon CN5010 based), CN5010 > have single MDIO bus for 3 Ethernet interfaces. First and second NICs > attached to MII0 and MII1 ports of BCM53115, but third attached to > real PHY :) > > Last case I configuring with following hints: > hint.miibus.0.phymask="0x00000001" > hint.miibus.0.phy0="switch" > hint.miibus.2.phymask="0x00000020" > hint.miibus.2.phy5="plumbphy" > hint.miibus.3.phymask="0x00000100" > > Maybe we have better way? > > Will wait for any opinion. > Apart from some style issues I'm fine with the phymask part, actually I've nearly the same patch in one of my trees. I think we can do better regarding hinted PHYs though. I was hoping to be able to look into this over the week-end but unfortunately two other committers came up with more urgent stuff. I hope to get to it over the next couple of days. Marius From owner-freebsd-embedded@FreeBSD.ORG Mon Nov 14 00:38:33 2011 Return-Path: Delivered-To: embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BED2106566B for ; Mon, 14 Nov 2011 00:38:33 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id D7E138FC08 for ; Mon, 14 Nov 2011 00:38:32 +0000 (UTC) Received: by vws11 with SMTP id 11so6867138vws.13 for ; Sun, 13 Nov 2011 16:38:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=sBDNdV7cOWNaUwqu4pMab9l+ss5xfIlOsZrIZ+87uHo=; b=ujHh000tiRIcSt9yzPv531RulFNRXK5efSUrCU7Yb/iwoB2pjSO9FctvWg+xmYNTcp vlNHscJk2dTMJegegXL2hJN2eo1xvc+2zMMwmaiMw8HOheHC9mzQMF7gyC4oZnHTbcSf AZUKfIM4qPB7kr5D+nndajYioFJItXq3Og7K8= MIME-Version: 1.0 Received: by 10.52.92.84 with SMTP id ck20mr31882987vdb.88.1321231111982; Sun, 13 Nov 2011 16:38:31 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.52.29.198 with HTTP; Sun, 13 Nov 2011 16:38:31 -0800 (PST) In-Reply-To: <20111113225907.GS93221@alchemy.franken.de> References: <20111110014904.0e8caf2c.ray@ddteam.net> <20111111004514.04bc27be.ray@ddteam.net> <20111113225907.GS93221@alchemy.franken.de> Date: Sun, 13 Nov 2011 16:38:31 -0800 X-Google-Sender-Auth: o6-vSkdnrd7y4D1ZyB_nUonZcdY Message-ID: From: Adrian Chadd To: Marius Strobl Content-Type: text/plain; charset=ISO-8859-1 Cc: embedded@freebsd.org Subject: Re: Ethernet switch framework X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Nov 2011 00:38:33 -0000 Sweet, so hopefully we can tidy up this part and get it into -HEAD soon? Thanks, Adrian From owner-freebsd-embedded@FreeBSD.ORG Mon Nov 14 11:07:04 2011 Return-Path: Delivered-To: freebsd-embedded@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84C951065674 for ; Mon, 14 Nov 2011 11:07:04 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 732078FC18 for ; Mon, 14 Nov 2011 11:07:04 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id pAEB746s083471 for ; Mon, 14 Nov 2011 11:07:04 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id pAEB73dH083469 for freebsd-embedded@FreeBSD.org; Mon, 14 Nov 2011 11:07:03 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 14 Nov 2011 11:07:03 GMT Message-Id: <201111141107.pAEB73dH083469@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-embedded@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-embedded@FreeBSD.org X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Nov 2011 11:07:04 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o misc/52256 embedded [picobsd] picobsd build script does not read in user/s o kern/42728 embedded [picobsd] many problems in src/usr.sbin/ppp/* after c 2 problems total.