Author: pgf
Date: 2009-12-21 16:54:00 +0100 (Mon, 21 Dec 2009)
New Revision: 1637
Modified:
cpu/x86/pc/olpc/via/mfgtests.txt
Log:
update with answers to a few of the questions re: the post-selftest stage.
Modified: cpu/x86/pc/olpc/via/mfgtests.txt
===================================================================
--- cpu/x86/pc/olpc/via/mfgtests.txt 2009-12-18 19:25:35 UTC (rev 1636)
+++ cpu/x86/pc/olpc/via/mfgtests.txt 2009-12-21 15:54:00 UTC (rev 1637)
@@ -111,13 +111,17 @@
wait-scanner
tag exchange with server
barcode scan of serial number to verify that the board and case are still paired
- ??? Is the filename the MB (B#) or the case serial number (SN) ?
- ??? If the filename is the SN, why is the SN in the request file?
- The server can't verify if it only has the SN and not the board#
+ the filename used in the tag exchange is based on the SN, despite
+ the additional cross-checking that would be available if it were
+ based on the MB number (B#).
delete MS and BD tags, insert tags from server
??? what is the format of the WP:N and AK:N info from the server? Is it WP:0 / WP:1, or presence/absence ?
TS should be SHIP at this point
??? Does the server send TS:SHIP or does the script inject it verbatim?
+ the TS tag as sent from the server is "FINAL". the script changes
+ it to "SHIP".
+ the final result report is submitted to the "Handshake" directory
+ on the server. (not "Result")
# If selftest failed, red screen and stop. State of machine (BD tag,
\runin\olpc.fth) left the same as at the start of this phase so
Author: wmb
Date: 2009-12-18 20:25:35 +0100 (Fri, 18 Dec 2009)
New Revision: 1636
Added:
dev/logdev.fth
Modified:
cpu/x86/pc/olpc/via/fw.bth
Log:
OLPC trac 9903 - Added console logging facility.
Modified: cpu/x86/pc/olpc/via/fw.bth
===================================================================
--- cpu/x86/pc/olpc/via/fw.bth 2009-12-18 16:47:33 UTC (rev 1635)
+++ cpu/x86/pc/olpc/via/fw.bth 2009-12-18 19:25:35 UTC (rev 1636)
@@ -505,6 +505,8 @@
fload ${BP}/cpu/x86/pc/olpc/via/fsverify.fth
devalias fsdisk int:0
+fload ${BP}/dev/logdev.fth
+
fload ${BP}/ofw/inet/sntp.fth
: olpc-ntp-servers ( -- )
" DHCP time 172.18.0.1 0.pool.ntp.org1.pool.ntp.org2.pool.ntp.org"
@@ -558,6 +560,7 @@
install-mux-io
cursor-off
true to text-on?
+ start-logging
" //null" open-dev to null-ih \ For text-off state
Added: dev/logdev.fth
===================================================================
--- dev/logdev.fth (rev 0)
+++ dev/logdev.fth 2009-12-18 19:25:35 UTC (rev 1636)
@@ -0,0 +1,145 @@
+\ See license at end of file
+purpose: Device to log console output to memory
+
+dev /
+new-device
+
+" log" device-name
+
+0 value open-count
+0 value log-buf
+0 value log-size
+0 value log-wptr
+0 value log-rptr
+h# 1000 value log-increment
+
+: open ( -- flag )
+ open-count 0= if
+ log-size log-increment + to log-size
+ log-size alloc-mem to log-buf
+ 0 to log-wptr
+ then
+ open-count 1+ to open-count
+ true
+;
+: close ( -- )
+ open-count 1 = if
+ log-buf log-size free-mem
+ 0 to log-size
+ 0 to log-buf
+ 0 to log-wptr
+ then
+ 0 to log-rptr
+ open-count 1- to open-count
+;
+
+: size ( -- ud ) log-wptr u>d ;
+: seek ( ud -- error? )
+ 0<> if drop true exit then ( low ) \ High word must be 0
+ dup log-size > if drop true exit then ( low )
+ to log-rptr
+;
+: write ( adr len -- actual )
+ dup log-wptr + log-size - ( adr len needed )
+ dup 0> if ( adr len needed )
+ log-increment round-up ( adr len needed' )
+ log-size + dup to log-size ( adr len new-size )
+ log-buf over resize if ( adr len new-size buf-adr )
+ 4drop 0 exit ( -- 0 )
+ then ( adr len new-size buf-adr )
+ to log-buf to log-size ( adr len )
+ else ( adr len needed )
+ drop ( adr len )
+ then ( adr len )
+ tuck log-buf log-wptr + swap move ( len )
+ dup log-wptr + to log-wptr ( len )
+;
+: read ( adr len -- actual )
+ log-wptr log-rptr - ( adr len avail )
+ min tuck ( actual adr actual )
+ log-rptr log-buf + -rot move ( actual )
+ dup log-rptr + to log-rptr ( actual )
+;
+: load ( adr -- len )
+ log-buf swap log-wptr move
+ log-wptr
+;
+
+finish-device
+device-end
+
+0 value log-ih
+: start-logging ( -- )
+ log-ih 0= if
+ " /log" open-dev to log-ih
+ log-ih add-output
+ then
+;
+: stop-logging ( -- )
+ log-ih if
+ log-ih remove-output
+ log-ih close-dev
+ 0 to log-ih
+ then
+;
+: save-log ( "filename" -- )
+ " /log" safe-parse-word $copy1
+;
+: no-esc-list ( adr len -- )
+ bounds ?do ( -- )
+ i c@ bl >= i c@ h# 9b <> and if
+ i c@ emit
+ else
+ i c@ case
+ newline of newline emit exit? ?leave endof
+ carret of carret emit endof
+ tab of tab emit endof
+\ bs of bs emit endof
+ h# 9b of ." ^[" endof
+ ( default )
+ ." ^" dup h# 1f and [char] @ or emit
+ endcase
+ then
+ loop
+;
+: show-log-no-ctl ( -- )
+ log-ih remove-output
+ ." <OFW_Console_Log>" cr
+ ['] no-esc-list ['] list ['] more (patch
+ " more /log" evaluate
+ ['] list ['] no-esc-list ['] more (patch
+ ." </OFW_Console_Log>" cr
+ log-ih add-output
+;
+
+: show-log ( -- )
+ log-ih remove-output
+ ." <OFW_Console_Log>" cr
+ " more /log" evaluate
+ ." </OFW_Console_Log>" cr
+ log-ih add-output
+;
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2009 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Author: wmb
Date: 2009-12-18 17:47:33 +0100 (Fri, 18 Dec 2009)
New Revision: 1635
Modified:
cpu/x86/pc/olpc/via/cstate.fth
Log:
OLPC trac 9917 - Added warning to lid power off and lid-off / lid-on commands
to disable / enable the lid shutdown function.
Modified: cpu/x86/pc/olpc/via/cstate.fth
===================================================================
--- cpu/x86/pc/olpc/via/cstate.fth 2009-12-18 16:34:29 UTC (rev 1634)
+++ cpu/x86/pc/olpc/via/cstate.fth 2009-12-18 16:47:33 UTC (rev 1635)
@@ -32,11 +32,20 @@
false value lid-already-down?
0 value lid-down-time
d# 10000 constant lid-shutdown-ms
+d# 2000 constant lid-warning-ms
+0 value lid-warned?
: ?lid-shutdown ( -- )
lid-down? if
lid-already-down? if
acpi-timer@ lid-down-time - d# 3580 / ( ms )
+
+ dup lid-warning-ms >= lid-warned? 0= and if
+ ." Lid switch is active - Powering off in 8 seconds" cr
+ ." Type lid-off to disable this function" cr
+ true to lid-warned?
+ then ( ms )
+
lid-shutdown-ms >= if
." Powering off after 10 seconds of lid down" cr
power-off
@@ -47,12 +56,18 @@
then
else
false to lid-already-down?
+ false to lid-warned?
then
;
+defer do-lid
+: lid-on ( -- ) ['] ?lid-shutdown to do-lid ;
+: lid-off ( -- ) ['] noop to do-lid ;
+lid-on
+
defer do-idle ' noop to do-idle
-: safe-idle ( -- ) can-idle? if do-idle then ?lid-shutdown ;
+: safe-idle ( -- ) can-idle? if do-idle then do-lid ;
' safe-idle to stdin-idle
alias c1-idle halt
Author: wmb
Date: 2009-12-18 17:34:29 +0100 (Fri, 18 Dec 2009)
New Revision: 1634
Modified:
cpu/x86/pc/olpc/via/cstate.fth
Log:
OLPC trac 9917 - OFW powers off the machine after 10 seconds with the lid closed.
Modified: cpu/x86/pc/olpc/via/cstate.fth
===================================================================
--- cpu/x86/pc/olpc/via/cstate.fth 2009-12-18 16:26:09 UTC (rev 1633)
+++ cpu/x86/pc/olpc/via/cstate.fth 2009-12-18 16:34:29 UTC (rev 1634)
@@ -28,9 +28,31 @@
then
;
+: lid-down? ( -- flag ) h# 48 acpi-l@ h# 80 and 0= ;
+false value lid-already-down?
+0 value lid-down-time
+d# 10000 constant lid-shutdown-ms
+
+: ?lid-shutdown ( -- )
+ lid-down? if
+ lid-already-down? if
+ acpi-timer@ lid-down-time - d# 3580 / ( ms )
+ lid-shutdown-ms >= if
+ ." Powering off after 10 seconds of lid down" cr
+ power-off
+ then
+ else
+ acpi-timer@ to lid-down-time
+ true to lid-already-down?
+ then
+ else
+ false to lid-already-down?
+ then
+;
+
defer do-idle ' noop to do-idle
-: safe-idle ( -- ) can-idle? if do-idle then ;
+: safe-idle ( -- ) can-idle? if do-idle then ?lid-shutdown ;
' safe-idle to stdin-idle
alias c1-idle halt
Author: wmb
Date: 2009-12-18 17:26:09 +0100 (Fri, 18 Dec 2009)
New Revision: 1633
Modified:
cpu/x86/pc/olpc/via/usb.fth
dev/usb2/hcd/ehci/ehci.fth
dev/usb2/hcd/ehci/probe.fth
Log:
OLPC trac 9902 - USB selftest in diagnostic mode now waits for a
device to be connected to each port.
Modified: cpu/x86/pc/olpc/via/usb.fth
===================================================================
--- cpu/x86/pc/olpc/via/usb.fth 2009-12-18 06:54:56 UTC (rev 1632)
+++ cpu/x86/pc/olpc/via/usb.fth 2009-12-18 16:26:09 UTC (rev 1633)
@@ -13,7 +13,7 @@
;
\ Restrict selftest to external USB ports 1,2,3
-dev / 2 " usb-max-test-port" integer-property dend
+dev / 3 " usb-test-ports" integer-property dend
: (probe-usb2) ( -- )
" device_type" get-property if exit then
Modified: dev/usb2/hcd/ehci/ehci.fth
===================================================================
--- dev/usb2/hcd/ehci/ehci.fth 2009-12-18 06:54:56 UTC (rev 1632)
+++ dev/usb2/hcd/ehci/ehci.fth 2009-12-18 16:26:09 UTC (rev 1633)
@@ -196,39 +196,6 @@
then
;
-external
-
-: selftest ( -- error? )
- ehci-reg dup 0= if map-regs then
-
- " usb-max-test-port" get-inherited-property if
- h# 7fffffff
- else ( adr len )
- decode-int nip nip
- then
-
- hcsparams@ h# f and min 0 ?do
- i portsc@ h# 2001 and if \ Port owned by usb 1.1 controller or device
- \ is present.
- ." USB 2.0 port " i u. ." in use" cr
- else
- diagnostic-mode? if
- ." Nothing connected to USB port " i u. " !" cr
- true unloop exit
- then
- ." Fisheye pattern out to USB 2.0 port " i u. cr
- i test-port-begin
- d# 2,000 ms
- i test-port-end
- 0 i portsc! i reset-port i power-port
- then
- loop
- 0= if unmap-regs then
- false
-;
-
-headers
-
\ LICENSE_BEGIN
\ Copyright (c) 2006 FirmWorks
\
Modified: dev/usb2/hcd/ehci/probe.fth
===================================================================
--- dev/usb2/hcd/ehci/probe.fth 2009-12-18 06:54:56 UTC (rev 1632)
+++ dev/usb2/hcd/ehci/probe.fth 2009-12-18 16:26:09 UTC (rev 1633)
@@ -30,7 +30,10 @@
make-device-node ( )
;
+0 instance value probe-error? \ Back channel to selftest
+
: probe-root-hub-port ( port -- )
+ false to probe-error?
dup portsc@ 1 and 0= if drop exit then \ No device detected
dup portsc@ h# c00 and h# 400 = if \ A low speed device detected
dup disown-port \ Disown the port
@@ -41,9 +44,11 @@
else \ A high speed device detected
dup ['] make-root-hub-node catch if \ Process high speed device
drop ." Failed to probe root port " dup .d cr
+ true to probe-error?
then
then
- then drop
+ then ( port# )
+ dup portsc@ swap portsc! ( ) \ Clear connection change bit
;
: grab-controller ( -- error? )
@@ -69,7 +74,44 @@
false
;
+: probe-setup ( -- )
+ \ Set active-package so device nodes can be added and removed
+ my-self ihandle>phandle push-package
+
+ alloc-pkt-buf
+;
+: probe-teardown ( -- )
+ free-pkt-buf
+ pop-package
+;
+
+: #testable-ports ( -- n )
+ #ports ( #hardware-ports )
+ " usb-test-ports" get-inherited-property 0= if ( #hardware-ports adr len )
+ decode-int nip nip min ( #testable-ports )
+ then ( #testable-ports )
+;
+
+: wait-connect ( port# -- error? )
+ begin ( port# )
+ dup portsc@ h# 2001 and 0= ( port# unconnected? )
+ while ( port# )
+ key? if ( port# )
+ key h# 1b = if ( port# ) \ ESC aborts
+ drop true exit ( -- true )
+ then ( port# )
+ then ( port# )
+ repeat ( port# )
+ ." Device connected - probing ... "
+ probe-setup ( port# )
+ dup probe-root-hub-port ( port# )
+ probe-teardown ( port# )
+ probe-error? ( error? )
+ dup if ." Failed" else ." Done" then cr ( error? )
+;
+
external
+
: power-usb-ports ( -- ) ;
: ports-changed? ( -- flag )
@@ -80,20 +122,16 @@
;
: probe-root-hub ( -- )
- \ Set active-package so device nodes can be added and removed
- my-self ihandle>phandle push-package
+ probe-setup
- alloc-pkt-buf
#ports 0 ?do \ For each port
i portsc@ 2 and if \ Connection changed
i rm-obsolete-children \ Remove obsolete device nodes
i probe-root-hub-port \ Probe it
- i portsc@ i portsc! \ Clear connection change bit
then
loop
- free-pkt-buf
- pop-package
+ probe-teardown
;
: open ( -- flag )
@@ -135,6 +173,29 @@
open-count 0= if free-dma-buf unmap-regs then
;
+: selftest ( -- error? )
+ ehci-reg dup 0= if map-regs then
+
+ #testable-ports 0 ?do
+ i portsc@ h# 2001 and if \ Port owned by usb 1.1 controller (2000) or device is present (1)
+ ." USB 2.0 port " i u. ." in use" cr
+ else
+ diagnostic-mode? if
+ ." Please connect a device to USB port " i u. " !" cr
+ i wait-connect if true unloop exit then
+ else
+ ." Fisheye pattern out to USB 2.0 port " i u. cr
+ i test-port-begin
+ d# 2,000 ms
+ i test-port-end
+ 0 i portsc! i reset-port i power-port
+ then
+ then
+ loop
+ 0= if unmap-regs then
+ false
+;
+
headers
\ LICENSE_BEGIN