Date: Fri, 1 Feb 2013 16:58:21 GMT From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 221680 for review Message-ID: <201302011658.r11GwLFa064625@skunkworks.freebsd.org>
index | next in thread | raw e-mail
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); }help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302011658.r11GwLFa064625>
