Date: Tue, 30 Apr 2013 18:48:11 +0000 (UTC) From: Brooks Davis <brooks@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250115 - head/sys/dev/cfi Message-ID: <201304301848.r3UImBpW054880@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: brooks Date: Tue Apr 30 18:48:11 2013 New Revision: 250115 URL: http://svnweb.freebsd.org/changeset/base/250115 Log: MFP4 change 222060: On Intel devices, put the Factory PPR in kenv. On some FPGA boards it may be the only software accessable unique ID. Sponsored by: DARPA, AFRL Modified: head/sys/dev/cfi/cfi_core.c Modified: head/sys/dev/cfi/cfi_core.c ============================================================================== --- head/sys/dev/cfi/cfi_core.c Tue Apr 30 18:33:29 2013 (r250114) +++ head/sys/dev/cfi/cfi_core.c Tue Apr 30 18:48:11 2013 (r250115) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include <sys/bus.h> #include <sys/conf.h> #include <sys/endian.h> +#include <sys/kenv.h> #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/module.h> @@ -261,6 +262,10 @@ cfi_attach(device_t dev) struct cfi_softc *sc; u_int blksz, blocks; u_int r, u; +#ifdef CFI_SUPPORT_STRATAFLASH + uint64_t ppr; + char name[KENV_MNAMELEN], value[32]; +#endif sc = device_get_softc(dev); sc->sc_dev = dev; @@ -312,6 +317,20 @@ cfi_attach(device_t dev) "%s%u", cfi_driver_name, u); sc->sc_nod->si_drv1 = sc; +#ifdef CFI_SUPPORT_STRATAFLASH + /* + * Store the Intel factory PPR in the environment. In some + * cases it is the most unique ID on a board. + */ + if (cfi_intel_get_factory_pr(sc, &ppr) == 0) { + if (snprintf(name, sizeof(name), "%s.factory_ppr", + device_get_nameunit(dev)) < (sizeof(name) - 1) && + snprintf(value, sizeof(value), "0x%016jx", ppr) < + (sizeof(value) - 1)) + (void) setenv(name, value); + } +#endif + device_add_child(dev, "cfid", -1); bus_generic_attach(dev);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304301848.r3UImBpW054880>