Author: wmb
Date: 2009-12-16 09:37:06 +0100 (Wed, 16 Dec 2009)
New Revision: 1626
Modified:
cpu/x86/pc/olpc/rtcwake.fth
cpu/x86/pc/olpc/via/probemem.fth
cpu/x86/pc/olpc/via/rtcwake.fth
Log:
OLPC trac 9887 - added suspend/resume test to memory selftest.
Modified: cpu/x86/pc/olpc/rtcwake.fth
===================================================================
--- cpu/x86/pc/olpc/rtcwake.fth 2009-12-16 08:20:30 UTC (rev 1625)
+++ cpu/x86/pc/olpc/rtcwake.fth 2009-12-16 08:37:06 UTC (rev 1626)
@@ -51,7 +51,7 @@
: show-rtc-wake ." R" ;
-d# 1 constant rtc-alarm-delay
+d# 1 value rtc-alarm-delay
: pm-sleep-rtc ( -- )
0 acpi-l@ h# 400.0000 or 0 acpi-l! \ Enable RTC SCI
['] show-rtc-wake rtc-alarm-delay " set-alarm" clock-node @ $call-method
@@ -103,6 +103,22 @@
autowack-off
;
+: s3-selftest ( -- error? )
+ \ The general failure mode here is that it won't wake up, so
+ \ it's hard to return a real error code. We just have to rely
+ \ on the operator.
+ ." Testing S3 suspend/resume" cr
+ rtc-alarm-delay >r
+ ." Sleeping for 1 second .. " 1 to rtc-alarm-delay pm-sleep-rtc cr
+ ." Sleeping for 4 seconds .. " 4 to rtc-alarm-delay pm-sleep-rtc cr
+ ." Sleeping for 8 seconds .. " 8 to rtc-alarm-delay pm-sleep-rtc cr
+ r> to rtc-alarm-delay
+ false
+;
+dev /memory
+[ifdef] test-s3 ' s3-selftest to test-s3 [then]
+dend
+
stand-init: Century
h# 20 cmos-century cmos! \ The century is in BCD, hence h#
;
Modified: cpu/x86/pc/olpc/via/probemem.fth
===================================================================
--- cpu/x86/pc/olpc/via/probemem.fth 2009-12-16 08:20:30 UTC (rev 1625)
+++ cpu/x86/pc/olpc/via/probemem.fth 2009-12-16 08:37:06 UTC (rev 1626)
@@ -79,6 +79,7 @@
: 8u.h ( n -- ) push-hex (.8) type pop-base ;
[then]
: .chunk ( adr len -- ) ." Testing memory at: " swap 8u.h ." size " 8u.h cr ;
+defer test-s3 ( -- error? ) ' false is test-s3
: selftest ( -- error? )
" available" get-my-property if ." No available property" cr true exit then
( adr len )
@@ -88,7 +89,8 @@
\ We maintain a 1-1 convenience mapping so explicit mapping is unnecessary
memory-test-suite if 2drop true exit then ( rem$ )
repeat drop
- false
+
+ test-s3
;
device-end
Modified: cpu/x86/pc/olpc/via/rtcwake.fth
===================================================================
--- cpu/x86/pc/olpc/via/rtcwake.fth 2009-12-16 08:20:30 UTC (rev 1625)
+++ cpu/x86/pc/olpc/via/rtcwake.fth 2009-12-16 08:37:06 UTC (rev 1626)
@@ -51,7 +51,7 @@
: show-rtc-wake ." R" ;
-d# 1 constant rtc-alarm-delay
+d# 1 value rtc-alarm-delay
: pm-sleep-rtc ( -- )
0 acpi-l@ h# 400.0000 or 0 acpi-l! \ Enable RTC SCI
['] show-rtc-wake rtc-alarm-delay " set-alarm" clock-node @ $call-method
@@ -63,6 +63,19 @@
begin pm-sleep-rtc space dup . (cr 1+ key? until
key drop
;
+: s3-selftest ( -- error? )
+ \ The general failure mode here is that it won't wake up, so
+ \ it's hard to return a real error code. We just have to rely
+ \ on the operator.
+ ." Testing S3 suspend/resume" cr
+ rtc-alarm-delay >r
+ ." Sleeping for 1 second .. " 1 to rtc-alarm-delay pm-sleep-rtc cr
+ ." Sleeping for 4 seconds .. " 4 to rtc-alarm-delay pm-sleep-rtc cr
+ ." Sleeping for 8 seconds .. " 8 to rtc-alarm-delay pm-sleep-rtc cr
+ r> to rtc-alarm-delay
+ false
+;
+dev /memory ' s3-selftest to test-s3 dend
stand-init: Century
h# 20 cmos-century cmos! \ The century is in BCD, hence h#