From owner-p4-projects@FreeBSD.ORG Fri Feb 1 16:58:22 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1EA948C2; Fri, 1 Feb 2013 16:58:22 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D633D8BF for ; Fri, 1 Feb 2013 16:58:21 +0000 (UTC) (envelope-from bz@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id C7F8A1BD for ; Fri, 1 Feb 2013 16:58:21 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r11GwLI6064628 for ; Fri, 1 Feb 2013 16:58:21 GMT (envelope-from bz@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r11GwLFa064625 for perforce@freebsd.org; Fri, 1 Feb 2013 16:58:21 GMT (envelope-from bz@freebsd.org) Date: Fri, 1 Feb 2013 16:58:21 GMT Message-Id: <201302011658.r11GwLFa064625@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bz@freebsd.org using -f From: "Bjoern A. Zeeb" Subject: PERFORCE change 221680 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2013 16:58:22 -0000 http://p4web.freebsd.org/@@221680?ac=10 Change 221680 by bz@bz_zenith on 2013/02/01 16:57:44 Export the factory PPR to kenv so that user space can access it. Using kenv now so that in the case of loader we would not have to adjust user space code anymore. This is a per-board unique 64bit value which we can use to derive Ethernet address from and possibly seed into the random pool as well. Affected files ... .. //depot/projects/ctsrd/beribsd/src/sys/dev/isf/isf.c#14 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/sys/dev/isf/isf.c#14 (text+ko) ==== @@ -686,6 +686,7 @@ uint16_t id; u_long start, size; struct isf_chips *cp = chip_ids; + char name[112], value[32]; start = rman_get_start(sc->isf_res); if (start % 2 != 0) { @@ -717,6 +718,22 @@ ISF_LOCK_INIT(sc); sc->isf_disk = NULL; isf_disk_insert(sc, size); + +#if 1 + /* + * Try best effort to export the information, currently only needed + * to do Ethernet address initialization. Later loader will do this + * thus we prefer kenv here rather than a sysctl. + */ + isf_write_cmd(sc, 0, ISF_CMD_RDI); + if (snprintf(name, sizeof(name), "%s.factory_ppr", + device_get_nameunit(sc->isf_dev)) < (sizeof(name) - 1) && + snprintf(value, sizeof(value), "0x%016jx", + (uintmax_t)isf_read_reg64(sc, ISF_REG_FPP)) < (sizeof(value) - 1)) + (void) setenv(name, value); + isf_write_cmd(sc, 0, ISF_CMD_RA); +#endif + return(0); }