From owner-svn-src-projects@FreeBSD.ORG Sat Feb 7 05:38:20 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFCF7106566C; Sat, 7 Feb 2009 05:38:20 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC6B48FC0A; Sat, 7 Feb 2009 05:38:20 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n175cKxj082277; Sat, 7 Feb 2009 05:38:20 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n175cKbH082276; Sat, 7 Feb 2009 05:38:20 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902070538.n175cKbH082276@svn.freebsd.org> From: Sam Leffler Date: Sat, 7 Feb 2009 05:38:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188270 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Feb 2009 05:38:21 -0000 Author: sam Date: Sat Feb 7 05:38:20 2009 New Revision: 188270 URL: http://svn.freebsd.org/changeset/base/188270 Log: merge r188267-188268: expand CFI_ARMEDANDDANGEROUS to cover writing the user segment of the PR Modified: projects/vap7/sys/ (props changed) projects/vap7/sys/contrib/pf/ (props changed) projects/vap7/sys/dev/ (props changed) projects/vap7/sys/dev/ath/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed) projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed) projects/vap7/sys/dev/cfi/cfi_core.c projects/vap7/sys/dev/cxgb/ (props changed) projects/vap7/sys/dev/usb2/ (props changed) projects/vap7/sys/i386/conf/USB2 (props changed) projects/vap7/sys/modules/usb2/ (props changed) projects/vap7/sys/net80211/ (props changed) Modified: projects/vap7/sys/dev/cfi/cfi_core.c ============================================================================== --- projects/vap7/sys/dev/cfi/cfi_core.c Sat Feb 7 05:34:41 2009 (r188269) +++ projects/vap7/sys/dev/cfi/cfi_core.c Sat Feb 7 05:38:20 2009 (r188270) @@ -438,9 +438,9 @@ cfi_write_block(struct cfi_softc *sc) * used for security. There are two 64-bit segments; one is programmed * at the factory with a unique 64-bit number which is immutable. * The other segment is left blank for User (OEM) programming. - * Once the User/OEM segment is programmed it can be locked - * to prevent future programming by writing bit 0 of the Protection - * Lock Register (PLR). The PLR can written only once. + * The User/OEM segment is One Time Programmable (OTP). It can also + * be locked to prevent any firther writes by setting bit 0 of the + * Protection Lock Register (PLR). The PLR can written only once. */ static uint16_t @@ -450,11 +450,13 @@ cfi_get16(struct cfi_softc *sc, int off) return v; } +#ifdef CFI_ARMEDANDDANGEROUS static void cfi_put16(struct cfi_softc *sc, int off, uint16_t v) { bus_space_write_2(sc->sc_tag, sc->sc_handle, off<<1, v); } +#endif /* * Read the factory-defined 64-bit segment of the PR. @@ -496,17 +498,21 @@ cfi_intel_get_oem_pr(struct cfi_softc *s /* * Write the User/OEM 64-bit segment of the PR. + * XXX should allow writing individual words/bytes */ int cfi_intel_set_oem_pr(struct cfi_softc *sc, uint64_t id) { +#ifdef CFI_ARMEDANDDANGEROUS register_t intr; int i, error; +#endif if (sc->sc_cmdset != CFI_VEND_INTEL_ECS) return EOPNOTSUPP; KASSERT(sc->sc_width == 2, ("sc_width %d", sc->sc_width)); +#ifdef CFI_ARMEDANDDANGEROUS for (i = 7; i >= 4; i--, id >>= 16) { intr = intr_disable(); cfi_write(sc, 0, CFI_INTEL_PP_SETUP); @@ -519,6 +525,11 @@ cfi_intel_set_oem_pr(struct cfi_softc *s } cfi_write(sc, 0, CFI_BCS_READ_ARRAY); return error; +#else + device_printf(sc->sc_dev, "%s: OEM PR not set, " + "CFI_ARMEDANDDANGEROUS not configured\n", __func__); + return ENXIO; +#endif } /* @@ -547,9 +558,8 @@ cfi_intel_set_plr(struct cfi_softc *sc) { #ifdef CFI_ARMEDANDDANGEROUS register_t intr; -#endif int error; - +#endif if (sc->sc_cmdset != CFI_VEND_INTEL_ECS) return EOPNOTSUPP; KASSERT(sc->sc_width == 2, ("sc_width %d", sc->sc_width)); @@ -563,11 +573,11 @@ cfi_intel_set_plr(struct cfi_softc *sc) intr_restore(intr); error = cfi_wait_ready(sc, CFI_BCS_READ_STATUS, sc->sc_write_timeout); cfi_write(sc, 0, CFI_BCS_READ_ARRAY); + return error; #else device_printf(sc->sc_dev, "%s: PLR not set, " "CFI_ARMEDANDDANGEROUS not configured\n", __func__); - error = ENXIO; + return ENXIO; #endif - return error; } #endif /* CFI_SUPPORT_STRATAFLASH */