Author: pgf Date: 2010-01-09 00:12:36 +0100 (Sat, 09 Jan 2010) New Revision: 1652
Modified: cpu/x86/pc/olpc/via/assy.fth cpu/x86/pc/olpc/via/runin.fth cpu/x86/pc/olpc/via/smt.fth Log: add support for the Pr tag. apply (many of) the changes requested by Wei-Heng in the files he sent. one concern: his "set-tag-assy" routine has a hard-coded server address, something we were trying to avoid.
Modified: cpu/x86/pc/olpc/via/assy.fth =================================================================== --- cpu/x86/pc/olpc/via/assy.fth 2010-01-08 07:30:03 UTC (rev 1651) +++ cpu/x86/pc/olpc/via/assy.fth 2010-01-08 23:12:36 UTC (rev 1652) @@ -11,7 +11,7 @@ : swid$ ( -- adr len ) " OFW ASSY test $Revision$" ;
\ Location of the files containing KA tag data -: ka-dir$ ( -- adr len ) " http:\10.1.0.1\ka" ; +: ka-dir$ ( -- adr len ) " http:\10.0.0.1\ka" ;
: find-firmware-file ( -- name$ ) wanted-fw$ " u:\boot\%s.rom" sprintf ( name$ ) @@ -42,6 +42,7 @@ ." Fetching KA tag file " 2dup type cr ( value$ key$ filename$ ) $read-file if ( value$ key$ ) ." ERROR: No KA tag file for " 2swap type cr ( key$ ) + true abort" KA file not found" ( key$ ) 2drop ( ) else ( value$ key$ file-data$ ) 2swap ($add-tag) ( value$ ) @@ -74,7 +75,7 @@ ;
d# 20 buffer: sn-buf -: sn$ ( -- adr len ) sn-buf count ; +: sn$ ( -- adr len ) sn-buf count ;
: try-get-sn ( -- ) sn-buf 1+ d# 20 accept ( n ) @@ -91,13 +92,26 @@ true ;
+: handle-pr-tag + " SN" find-tag 0= abort" Found Pr with no SN" + 2dup + ." Will use existing SN tag for serial number: " type cr + -null + sn-buf place +; + : get-sn ( -- ) - ." *****" - - begin - " Please Input Serial Number ......" .instructions - try-get-sn - until + " Pr" find-tag if ( prval$ -- ) + 2drop ( -- ) + handle-pr-tag + exit + else + ." *****" + begin + " Please Input Serial Number ......" .instructions + try-get-sn + until + then ;
d# 38 buffer: uuid-buf @@ -177,6 +191,24 @@ $copy1 ;
+: check-err-msg ( adr len -- ) + begin dup while ( adr len ) + linefeed left-parse-string ( rem$ line$ ) + ?remove-cr ( rem$ line$ ) + [char] : left-parse-string ( rem$ value$ key$ ) + " ERR_MSG" $= if ( rem$ value$ ) + page show-fail + type ( rem$ ) + cr cr + ." Perss any key to power off!" + key drop cr cr + power-off + then ( rem$ value$ ) + 2drop ( rem$ ) + repeat ( rem$ ) + 2drop ( ) +; + 0 0 2value response$
: execute-downloads ( adr len -- ) @@ -220,7 +252,11 @@ " BD" ($delete-tag) \ leave NT so we can use one tag throughout: " NT" ($delete-tag)
- sn$ " SN" put-tag + " Pr" find-tag if + ." Preserving existing SN tag" cr + else + sn$ " SN" put-tag + then fwver$ " BV" put-tag swid$ " T#" put-tag uuid$ " U#" put-tag @@ -251,12 +287,20 @@ make-assy-request ( ) " Request" submit-file ( ) " Response" get-response to response$ + response$ check-err-msg ;
+: wait-connections ( -- ) + silent-probe-usb + wait-scanner + ?usb-keyboard + wait-lan +; + : start-assy-test ( -- ) ?update-firmware
- wait-lan + wait-connections
get-info
@@ -268,6 +312,11 @@
inject-tags
+ clear-screen + ." Download PASS... Please press a key to power off." cr cr cr + green-screen + key drop cr cr + ." Powering off ..." d# 2000 ms power-off ;
Modified: cpu/x86/pc/olpc/via/runin.fth =================================================================== --- cpu/x86/pc/olpc/via/runin.fth 2010-01-08 07:30:03 UTC (rev 1651) +++ cpu/x86/pc/olpc/via/runin.fth 2010-01-08 23:12:36 UTC (rev 1652) @@ -16,6 +16,36 @@ \ the failure log (if int:\runin\fail.log is present) or modifies the \ manufacturing data tags to cause the next boot to enter final test.
+d# 128 buffer: mb-buf : mb$ mb-buf count ; + +: get-mb-tags ( --) + " B#" find-tag if + ?-null + then + mb-buf place +; + +: set-tag-assy ( --) + get-mb-tags + + clear-mfg-buf + + " " " ww" put-ascii-tag + + " "(D3)" " SG" ($add-tag) + mb$ " B#" put-ascii-tag + " EN" " SS" put-ascii-tag + + " ASSY" " TS" put-ascii-tag + " cifs:\Administrator:qmsswdl@10.0.0.2\OLPC_TM" " MS" put-ascii-tag + " u:\boot\olpc.fth net" " BD" put-ascii-tag + + flash-write-enable + (put-mfg-data) + no-kbc-reboot + kbc-on +; + d# 20 buffer: sn-buf : sn$ ( -- adr len ) sn-buf count ;
@@ -48,20 +78,44 @@ -null ;
-: get-info ( -- ) - scan-sn -; +: get-sn-value ( --) + " SN" find-tag if + ?-null + else + abort" Missing SN tag !!!" + then + sn-buf place +;
0 0 2value response$
: final-filename$ ( -- adr len ) sn$ " %s.txt" sprintf ;
+: check-err-msg ( adr len -- ) + begin dup while ( adr len ) + linefeed left-parse-string ( rem$ line$ ) + ?remove-cr ( rem$ line$ ) + [char] : left-parse-string ( rem$ value$ key$ ) + " ERR_MSG" $= if ( rem$ value$ ) + page show-fail + type ( rem$ ) + cr cr + ." Perss any key to power off!" + key drop cr cr + power-off + then ( rem$ value$ ) + 2drop ( rem$ ) + repeat ( rem$ ) + 2drop ( ) +; + \ Send the board number as the request and return the response data : final-tag-exchange ( -- ) final-filename$ open-temp-file sn$ " SN:" put-key+value " Request" submit-file " Response" get-response to response$ + response$ check-err-msg ;
: show-result-screen ( -- ) @@ -71,6 +125,7 @@ green-screen else ." FAIL" cr cr + set-tag-assy red-screen then ; @@ -79,6 +134,7 @@ 2over 8 min ka-dir$ " %s%s" sprintf ( value$ key$ filename$ ) $read-file if ( value$ key$ ) ." ERROR: No KA tag file for " 2swap type cr ( key$ ) + true abort" KA file not found" ( key$ ) 2drop ( ) else ( value$ key$ file-data$ ) 2swap ($add-tag) ( value$ ) @@ -171,6 +227,7 @@ " BD" ($delete-tag) " NT" ($delete-tag) " MD" ($delete-tag) + " Pr" ($delete-tag) make-md-tag
response$ parse-tags @@ -263,8 +320,6 @@
: wait-connections ( -- ) silent-probe-usb - wait-scanner - ?usb-keyboard wait-lan ;
@@ -294,9 +349,14 @@
: finish-final-test ( -- ) + + " del int:\runin\olpc.fth" ['] eval catch + " copy int:\runin\repass.fth int:\runin\olpc.fth" ['] eval catch + " del int:\runin\repass.fth" ['] eval catch + wait-connections
- get-info + get-sn-value
verify-rtc-date
Modified: cpu/x86/pc/olpc/via/smt.fth =================================================================== --- cpu/x86/pc/olpc/via/smt.fth 2010-01-08 07:30:03 UTC (rev 1651) +++ cpu/x86/pc/olpc/via/smt.fth 2010-01-08 23:12:36 UTC (rev 1652) @@ -34,22 +34,56 @@ ' mfg-ntp-server to ntp-servers
d# 20 buffer: bn-buf \ Buffer for scanned-in board number string -: board#$ ( -- adr len ) bn-buf count ; +: board#$ ( -- adr len ) bn-buf count ; +d# 20 buffer: sn-buf \ Buffer for preserving serial number string +: sn$ ( -- adr len ) sn-buf count ;
+: save-manuf-data + ." Connecting to save mfg data .. " cifs-connect ." Connected .. " + sn$ open-temp-file + mfg-data-range cifs-write + " MfgDataSave" submit-file + cifs-disconnect +; + +: handle-pr-tag + " B#" find-tag 0= abort" Found Pr with no B#" + 2dup + ." Will use existing B# tag for board number: " type cr + -null + bn-buf place + + " SN" find-tag 0= abort" Found Pr with no SN" + 2dup + ." Will use existing SN tag for serial number: " type cr + -null + sn-buf place + + save-manuf-data +; + \ Get a board number from the user, retrying until valid \ Usually the number is entered with a barcode scanner +\ If the Pr tag is present, make steps to preserve board and +\ serial numbers, and avoid prompting for them. : get-board# ( -- ) - ." *****" - begin - " Please Input Board Number ......" .instructions - bn-buf d# 20 accept-to-buf ( n ) - d# 14 <> if - " Wrong length (must be 14 characters), try again" .problem - else - bn-buf 1+ c@ [char] Q = if exit then - " Must begin with Q, try again" .problem - then - again + " Pr" find-tag if + 2drop + handle-pr-tag + exit + else + ." *****" + begin + " Please Input Board Number ......" .instructions + bn-buf d# 20 accept-to-buf ( n ) + d# 14 <> if + " Wrong length (must be 14 characters), try again" .problem + else + bn-buf 1+ c@ [char] Q = if exit then + " Must begin with Q, try again" .problem + then + again + then ;
d# 20 buffer: station#-buf @@ -146,6 +180,25 @@ put-ascii-tag ;
+: check-err-msg ( adr len -- ) + begin dup while ( adr len ) + linefeed left-parse-string ( rem$ line$ ) + ?remove-cr ( rem$ line$ ) + [char] : left-parse-string ( rem$ value$ key$ ) + " ERR_MSG" $= if ( rem$ value$ ) + page show-fail + type ( rem$ ) + cr cr + ." Press any key to power off!" + key drop cr cr + power-off + then ( rem$ value$ ) + 2drop ( rem$ ) + repeat ( rem$ ) + 2drop ( ) +; + + 0 0 2value response$
false value any-tags? @@ -182,6 +235,10 @@
" EN" " SS" put-ascii-tag ( )
+ sn$ dup 0<> if + " SN" put-ascii-tag + " x" " Pr" put-ascii-tag then + \ board#$ " B#" put-ascii-tag ( ) \ " ASSY" " TS" put-ascii-tag ( ) \ " "(D3)" " SG" ($add-tag) ( ) @@ -239,6 +296,8 @@ cifs-disconnect ." Done" cr
+ response$ check-err-msg + autorun-mfg-tests
." Sending test result "