[OpenBIOS] r670 - cpu/x86/pc/olpc

svn at openbios.org svn at openbios.org
Wed Oct 10 02:10:18 CEST 2007


Author: wmb
Date: 2007-10-10 02:10:18 +0200 (Wed, 10 Oct 2007)
New Revision: 670

Added:
   cpu/x86/pc/olpc/timertest.fth
Modified:
   cpu/x86/pc/olpc/devices.fth
Log:
OLPC Trac #4050 - added selftest /isa/timer to catch broken 14 MHz clocks.


Modified: cpu/x86/pc/olpc/devices.fth
===================================================================
--- cpu/x86/pc/olpc/devices.fth	2007-10-10 00:08:32 UTC (rev 669)
+++ cpu/x86/pc/olpc/devices.fth	2007-10-10 00:10:18 UTC (rev 670)
@@ -64,6 +64,8 @@
 
 [then]
 
+fload ${BP}/cpu/x86/pc/olpc/timertest.fth  \ Selftest for PIT timer
+
 1 [if]
 dev /interrupt-controller
 h# 20 to vector-base0
@@ -111,6 +113,9 @@
 [then]
 
 fload ${BP}/dev/pci/isaall.fth
+\ We don't need a serial selftest because the serial port is internal only
+\ and the selftest turns off the diag device
+dev /serial  warning @ warning off  : selftest false ;  warning !  device-end
 devalias com1 /isa/serial at i3f8:115200
 devalias mouse /isa/8042/mouse
 devalias d disk

Added: cpu/x86/pc/olpc/timertest.fth
===================================================================
--- cpu/x86/pc/olpc/timertest.fth	                        (rev 0)
+++ cpu/x86/pc/olpc/timertest.fth	2007-10-10 00:10:18 UTC (rev 670)
@@ -0,0 +1,61 @@
+purpose: Selftest for ISA timer
+\ See license at end of file
+
+dev /isa/timer
+
+: wait-rollover  ( -- error? )
+   get-msecs  d# 200 +   begin   ( time-limit )
+      0 count@ 1 =  if  drop false exit  then
+      dup get-msecs -            ( time-limit diff )
+   0<= until
+   drop true
+;
+: selftest  ( -- error? )
+   0 count@  0=  if
+      1 ms
+      0 count@ 0=  if
+         ." The ISA PIT timer is not ticking."  cr
+         ." Possible cause: bad 14 MHz clock to CS5536 chip." cr
+         true exit
+      then
+   then
+
+   wait-rollover  if
+      ." The ISA PIT timer did not reach a count of 1."  cr
+      true exit
+   then
+
+   1 ms
+
+   0 count@  d# 10000 d# 11000 between  0=  if
+      ." The ISA PIT timer is ticking at the wrong rate." cr
+      true exit
+   then
+
+   false
+;
+
+device-end
+\ LICENSE_BEGIN
+\ Copyright (c) 2007 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




More information about the OpenBIOS mailing list