Author: wmb Date: Sat Nov 6 00:04:42 2010 New Revision: 2016 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2016
Log: OLPC - Get OFW version from the model property in /openprom, so there is only one place that knows how to access the data from FLASH (because SPI FLASH is not memory mapped on XO-1.75).
Modified: cpu/arm/olpc/1.75/devices.fth cpu/x86/pc/olpc/banner.fth cpu/x86/pc/olpc/security.fth cpu/x86/pc/olpc/via/banner.fth
Modified: cpu/arm/olpc/1.75/devices.fth ============================================================================== --- cpu/arm/olpc/1.75/devices.fth Fri Nov 5 19:56:34 2010 (r2015) +++ cpu/arm/olpc/1.75/devices.fth Sat Nov 6 00:04:42 2010 (r2016) @@ -254,6 +254,34 @@
fload ${BP}/dev/olpc/mmp2camera/loadpkg.fth
+warning @ warning off +: stand-init + stand-init + root-device +[ifdef] notyet + model-name$ 2dup model ( name$ ) + " OLPC " encode-bytes 2swap encode-string encode+ " banner-name" property + board-revision " board-revision-int" integer-property +[then] + \ The "1-" removes the null byte + " SN" find-tag if 1- else " Unknown" then " serial-number" string-property +[ifdef] notyet + 8 ec-cmd-b@ dup " ec-version" integer-property + + XXX Get EC name with an EC command + " ec-name" string-property +[then] + dend + + " /openprom" find-device + flash-open pad d# 16 2dup h# fffc0 flash-read ( adr len ) + " model" string-property + + " sourceurl" find-drop-in if " source-url" string-property then + dend +; +warning ! + \ LICENSE_BEGIN \ Copyright (c) 2010 FirmWorks \
Modified: cpu/x86/pc/olpc/banner.fth ============================================================================== --- cpu/x86/pc/olpc/banner.fth Fri Nov 5 19:56:34 2010 (r2015) +++ cpu/x86/pc/olpc/banner.fth Sat Nov 6 00:04:42 2010 (r2016) @@ -3,15 +3,19 @@
headerless
+: ofw-model$ ( -- adr len ) + " /openprom" find-package drop ( phandle ) + " model" rot get-package-property if + " ??? ????? ???" + else + decode-string + then +; +: ofw-version$ ( -- adr len ) + ofw-model$ drop 6 + 7 -trailing +; : .rom ( -- ) - ." OpenFirmware " - \ push-decimal - \ major-release (.) type ." ." minor-release (.) type sub-release type - \ pop-base - \ This is the manufacturing signature -[ifdef] rom-loaded - h# ffff.ffc0 h# 10 type -[then] + ." OpenFirmware " ofw-version$ type ;
: .ec
Modified: cpu/x86/pc/olpc/security.fth ============================================================================== --- cpu/x86/pc/olpc/security.fth Fri Nov 5 19:56:34 2010 (r2015) +++ cpu/x86/pc/olpc/security.fth Sat Nov 6 00:04:42 2010 (r2016) @@ -851,8 +851,8 @@ : ?force-secure ( -- ) button-x game-key? if true to secure? then ;
6 buffer: fw#buf -: (fw-version) ( base-adr -- n ) - h# f.ffc7 + fw#buf 5 move +: ((fw-version)) ( adr -- n ) + fw#buf 5 move fw#buf 4 + c@ bl = if [char] 0 fw#buf 4 + c! then base @ >r d# 36 base ! fw#buf 5 $number if @@ -861,11 +861,21 @@ then pop-base ; +: (fw-version) ( base-adr -- n ) + h# f.ffc7 + ((fw-version) +; + +\ Returns an integer that is derived from a base-36 decoding +\ of the OFW version number (e.g. Q2A36b) beginning at the +\ character after the Q. +: ofw-version-int ( -- n ) + ofw-version$ drop 1+ ((fw-version)) +;
: firmware-up-to-date? ( img$ -- ) /flash <> if show-x " Invalid Firmware image" .security-failure then ( adr ) - (fw-version) ( file-version# ) - rom-pa (fw-version) ( file-version# rom-version# ) + h# f.ffc7 + ((fw-version)) ( file-version# ) + ofw-version-int ( file-version# rom-version# ) u<= ;
Modified: cpu/x86/pc/olpc/via/banner.fth ============================================================================== --- cpu/x86/pc/olpc/via/banner.fth Fri Nov 5 19:56:34 2010 (r2015) +++ cpu/x86/pc/olpc/via/banner.fth Sat Nov 6 00:04:42 2010 (r2016) @@ -95,15 +95,19 @@ then ;
+: ofw-model$ ( -- adr len ) + " /openprom" find-package drop ( phandle ) + " model" rot get-package-property if + " ??? ????? ???" + else + decode-string + then +; +: ofw-version$ ( -- adr len ) + ofw-model$ drop 6 + 7 -trailing +; : .rom ( -- ) - ." OpenFirmware " - \ push-decimal - \ major-release (.) type ." ." minor-release (.) type sub-release type - \ pop-base - \ This is the manufacturing signature -[ifdef] rom-loaded - h# ffff.ffc0 h# 10 type -[then] + ." OpenFirmware " ofw-version$ type ;
: .ec