Author: wmb
Date: Thu Aug 5 02:46:03 2010
New Revision: 1915
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1915
Log:
OLPC - new ".speed" command for measuring read/write speeds of mass storage devices.
Added:
cpu/x86/pc/olpc/diskspeed.fth
Modified:
cpu/x86/acpitimer.fth
cpu/x86/pc/olpc/fw.bth
cpu/x86/pc/olpc/via/fw.bth
cpu/x86/tsc.fth
Modified: cpu/x86/acpitimer.fth
==============================================================================
--- cpu/x86/acpitimer.fth Thu Aug 5 02:37:12 2010 (r1914)
+++ cpu/x86/acpitimer.fth Thu Aug 5 02:46:03 2010 (r1915)
@@ -71,8 +71,9 @@
\ Subtracting 10 accounts for the time it takes to read the ACPI timer,
\ which is an I/O port and therefore slow to read
: ))t1 ( -- d.ticks ) get-timer timestamp 2@ d- d# 10. d- 0. dmax ;
+: ))t-usecs ( -- usec ) ))t1 acpi-ticks>usecs ;
: )t ( -- )
- ))t1 acpi-ticks>usecs ( microseconds )
+ ))t-usecs ( microseconds )
push-decimal
<# u# u# u# [char] , hold u# u#s u#> type ." uS "
pop-base
Added: cpu/x86/pc/olpc/diskspeed.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/x86/pc/olpc/diskspeed.fth Thu Aug 5 02:46:03 2010 (r1915)
@@ -0,0 +1,77 @@
+\ See license at end of file
+purpose: Disk raw read/write speed test
+
+\ Example: ok .speed ext:0
+\
+\ The test is non-destructive unless a write failure occurs.
+\ It reads first, then writes the same data back.
+
+0 value disk-ih
+0 value disk-speed-transfer
+0 value disk-speed-#blocks
+0 value disk-speed-/block
+0 value disk-speed-total-blocks
+h# 200.0000 constant disk-speed-len \ 32 MB
+
+: .mb/sec ( usecs -- )
+ disk-speed-len d# 20 rot */ ( 20*mb/sec )
+ 1+ 2/ ( 10*mb/sec-rounded )
+ push-decimal
+ <# u# [char] . hold u#s u#> type
+ pop-base
+ ." Mb/sec"
+;
+: .speed ( "devname" -- )
+ safe-parse-word open-dev to disk-ih
+ disk-ih 0= abort" Can't open device"
+ " block-size" disk-ih $call-method to disk-speed-/block
+
+ " max-transfer" disk-ih $call-method to disk-speed-transfer
+ disk-speed-transfer disk-speed-/block / to disk-speed-#blocks
+
+ disk-speed-len disk-speed-/block / to disk-speed-total-blocks
+
+ ." Read speed: "
+ t(
+ disk-speed-total-blocks 0 do
+ load-base i disk-speed-/block * + ( adr )
+ i disk-speed-#blocks " read-blocks" disk-ih $call-method drop
+ disk-speed-#blocks +loop
+ ))t-usecs ( usecs )
+ .mb/sec space
+
+ ." Write speed: "
+ t(
+ disk-speed-total-blocks 0 do
+ load-base i disk-speed-/block * + ( adr )
+ i disk-speed-#blocks " write-blocks" disk-ih $call-method drop
+ disk-speed-#blocks +loop
+ ))t-usecs ( usecs )
+ .mb/sec cr
+
+ disk-ih close-dev
+;
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2010 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
Modified: cpu/x86/pc/olpc/fw.bth
==============================================================================
--- cpu/x86/pc/olpc/fw.bth Thu Aug 5 02:37:12 2010 (r1914)
+++ cpu/x86/pc/olpc/fw.bth Thu Aug 5 02:46:03 2010 (r1915)
@@ -679,6 +679,8 @@
\ Fancy battery charge logger.
fload ${BP}/cpu/x86/pc/olpc/charge.fth
+fload ${BP}/cpu/x86/pc/olpc/diskspeed.fth \ Mass storage speed test
+
\ This helps with TeraTerm, which sends ESC-O as the arrow key prefix
also hidden also keys-forth definitions
warning @ warning off
Modified: cpu/x86/pc/olpc/via/fw.bth
==============================================================================
--- cpu/x86/pc/olpc/via/fw.bth Thu Aug 5 02:37:12 2010 (r1914)
+++ cpu/x86/pc/olpc/via/fw.bth Thu Aug 5 02:46:03 2010 (r1915)
@@ -748,6 +748,8 @@
\ Fancy battery charge logger.
fload ${BP}/cpu/x86/pc/olpc/charge.fth
+fload ${BP}/cpu/x86/pc/olpc/diskspeed.fth \ Mass storage speed test
+
\ This helps with TeraTerm, which sends ESC-O as the arrow key prefix
also hidden also keys-forth definitions
warning @ warning off
Modified: cpu/x86/tsc.fth
==============================================================================
--- cpu/x86/tsc.fth Thu Aug 5 02:37:12 2010 (r1914)
+++ cpu/x86/tsc.fth Thu Aug 5 02:46:03 2010 (r1915)
@@ -46,8 +46,9 @@
: t-update ;
: t( ( -- ) tsc@ timestamp 2! ;
: ))t ( -- d.ticks ) tsc@ timestamp 2@ d- ;
+: ))t-usecs ( -- usecs ) ))t us-factor um/mod nip ;
: )t ( -- )
- ))t us-factor um/mod nip ( microseconds )
+ ))t-usecs ( microseconds )
push-decimal
<# u# u# u# [char] , hold u# u#s u#> type ." uS "
pop-base
Author: wmb
Date: Thu Aug 5 02:37:12 2010
New Revision: 1914
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1914
Log:
OLPC keyboard selftest - faster/simpler version of stuck key sensing code.
Modified:
dev/olpc/keyboard/selftest.fth
Modified: dev/olpc/keyboard/selftest.fth
==============================================================================
--- dev/olpc/keyboard/selftest.fth Wed Aug 4 19:08:23 2010 (r1913)
+++ dev/olpc/keyboard/selftest.fth Thu Aug 5 02:37:12 2010 (r1914)
@@ -196,17 +196,7 @@
;
[then]
-: key-stuck? ( -- flag )
- ukey? if debug-me then
- #keys 0 do
- i key-adr >key-time @ ?dup if ( msecs )
- d# 3,000 + get-msecs - 0< if ( )
- true unloop exit
- then
- then
- loop
- false
-;
+0 value key-stuck?
d# 128 8 / constant #key-bytes
#key-bytes buffer: key-bitmap
@@ -519,7 +509,7 @@
: set-key-time ( timestamp key-adr -- )
over 0<> over >key-time @ 0<> and if ( timestamp key-adr )
\ If both timestamp and old key time are nonzero, then we preserve the old key time
- 2drop
+ >key-time @ d# 3,000 + - 0> to key-stuck?
else
\ If either timestamp or old key time is 0, we set the key time
>key-time !
@@ -640,6 +630,7 @@
make-keys
+ 0 to key-stuck?
cursor-off draw-keyboard
true to locked? \ Disable the keyboard alarm handler; it steals our scancodes
selftest-keys
Author: wmb
Date: Wed Aug 4 06:47:17 2010
New Revision: 1908
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1908
Log:
SD driver - added quirk for Marvell 88W8686 reset issue as described in Marvell AppNote AN-20017. It is possible that, without this workaround, the XO-1.5 WLAN module might fail to reset properly.
Added:
dev/mmc/sdhci/mv8686/quirk.fth
Modified:
dev/mmc/sdhci/sdhci.fth
dev/mmc/sdhci/sdhcixo.bth
Added: dev/mmc/sdhci/mv8686/quirk.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dev/mmc/sdhci/mv8686/quirk.fth Wed Aug 4 06:47:17 2010 (r1908)
@@ -0,0 +1,10 @@
+\ This is a workaround for a reset problem with the Marvell 88W8686
+\ as described in Marvell AppNote AN-20017. Basically, you have to
+\ pulse the external reset pin after powering up the module, otherwise
+\ it might not reset correctly.
+
+: mv8686-reset-quirk ( -- )
+ d# 50 ms
+ " wlan-reset" evaluate
+;
+' mv8686-reset-quirk to ?mv8686-quirk
Modified: dev/mmc/sdhci/sdhci.fth
==============================================================================
--- dev/mmc/sdhci/sdhci.fth Wed Aug 4 06:44:34 2010 (r1907)
+++ dev/mmc/sdhci/sdhci.fth Wed Aug 4 06:47:17 2010 (r1908)
@@ -23,6 +23,8 @@
h# 200 constant /block \ 512 bytes
+defer ?mv8686-quirk ' noop to ?mv8686-quirk
+
external
: set-address ( rca slot -- ) to slot to rca map-regs ;
: get-address ( -- rca ) rca ;
@@ -749,6 +751,7 @@
card-power-off d# 500 ms
card-power-on d# 50 ms \ This delay is just a guess (20 was barely too slow for a Via board)
card-inserted? 0= if card-power-off intstat-off false true exit then
+ ?mv8686-quirk
card-clock-slow d# 50 ms \ This delay is just a guess
reset-card \ Cmd 0
false
Modified: dev/mmc/sdhci/sdhcixo.bth
==============================================================================
--- dev/mmc/sdhci/sdhcixo.bth Wed Aug 4 06:44:34 2010 (r1907)
+++ dev/mmc/sdhci/sdhcixo.bth Wed Aug 4 06:47:17 2010 (r1908)
@@ -10,7 +10,7 @@
FCode-version2
fload ${BP}/dev/mmc/sdhci/pciregs.fth
fload ${BP}/dev/mmc/sdhci/sdhci.fth
-
+fload ${BP}/dev/mmc/sdhci/mv8686/quirk.fth
init
: populate-children ( -- )