From owner-svn-src-all@freebsd.org Thu Mar 31 13:13:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40C89AE411D; Thu, 31 Mar 2016 13:13:40 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF2891E40; Thu, 31 Mar 2016 13:13:39 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2VDDdbc091889; Thu, 31 Mar 2016 13:13:39 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2VDDdIF091888; Thu, 31 Mar 2016 13:13:39 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201603311313.u2VDDdIF091888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Thu, 31 Mar 2016 13:13:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297451 - head/sys/dev/vnic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2016 13:13:40 -0000 Author: zbb Date: Thu Mar 31 13:13:38 2016 New Revision: 297451 URL: https://svnweb.freebsd.org/changeset/base/297451 Log: Fix MAC address configuration for VNIC The FDT description is as follows: - phy-handle, reg, qlm-mode, mac-address are under nodes in bgx0/1 node - phy nodes (pointed by phy-handle) are under MDIO even though they may not be connected through to MDIO. In those nodes they do not contain MAC address or etc. This commit changes parsing of the FDT nodes for BGX so that it can obtain correct MAC address for a given PHY. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5781 Modified: head/sys/dev/vnic/thunder_bgx_fdt.c Modified: head/sys/dev/vnic/thunder_bgx_fdt.c ============================================================================== --- head/sys/dev/vnic/thunder_bgx_fdt.c Thu Mar 31 13:10:29 2016 (r297450) +++ head/sys/dev/vnic/thunder_bgx_fdt.c Thu Mar 31 13:13:38 2016 (r297451) @@ -285,18 +285,9 @@ bgx_fdt_init_phy(struct bgx *bgx) continue; } - if (OF_getencprop(child, "phy-handle", &phy, - sizeof(phy)) <= 0) { - if (bootverbose) { - device_printf(bgx->dev, - "No phy-handle in PHY node. Skipping...\n"); - } - continue; - } /* Acquire PHY address */ - phy = OF_node_from_xref(phy); - if (OF_getencprop(phy, "reg", &bgx->lmac[lmac].phyaddr, + if (OF_getencprop(child, "reg", &bgx->lmac[lmac].phyaddr, sizeof(bgx->lmac[lmac].phyaddr)) <= 0) { if (bootverbose) { device_printf(bgx->dev, @@ -305,6 +296,15 @@ bgx_fdt_init_phy(struct bgx *bgx) bgx->lmac[lmac].phyaddr = MII_PHY_ANY; } + if (OF_getencprop(child, "phy-handle", &phy, + sizeof(phy)) <= 0) { + if (bootverbose) { + device_printf(bgx->dev, + "No phy-handle in PHY node. Skipping...\n"); + } + continue; + } + phy = OF_instance_to_package(phy); /* * Get PHY interface (MDIO bus) device. * Driver must be already attached. @@ -321,7 +321,7 @@ bgx_fdt_init_phy(struct bgx *bgx) } /* Get mac address from FDT */ - bgx_fdt_get_macaddr(phy, bgx->lmac[lmac].mac); + bgx_fdt_get_macaddr(child, bgx->lmac[lmac].mac); bgx->lmac[lmac].lmacid = lmac; lmac++;