Author: wmb
Date: Thu Aug 5 21:03:43 2010
New Revision: 1917
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1917
Log:
OLPC - removed support for ancient manufacturing data location in EC code area.
Modified:
cpu/x86/pc/olpc/mfgdata.fth
dev/olpc/spiflash/spiui.fth
Modified: cpu/x86/pc/olpc/mfgdata.fth
==============================================================================
--- cpu/x86/pc/olpc/mfgdata.fth Thu Aug 5 02:47:11 2010 (r1916)
+++ cpu/x86/pc/olpc/mfgdata.fth Thu Aug 5 21:03:43 2010 (r1917)
@@ -44,11 +44,9 @@
true ( adr data$ name-adr true )
;
-\ Mfg data used to be at the end of the EC erase block, but
-\ is now in a block by itself.
+\ Mfg data is in a block by itself.
: mfg-data-top ( -- adr )
- flash-base h# 1.0000 + dup invalid-tag? ( old-top data-adr flag )
- nip if drop flash-base h# f.0000 + then
+ flash-base h# f.0000 +
;
: (find-tag) ( name$ top-adr -- false | data$ true )
Modified: dev/olpc/spiflash/spiui.fth
==============================================================================
--- dev/olpc/spiflash/spiui.fth Thu Aug 5 02:47:11 2010 (r1916)
+++ dev/olpc/spiflash/spiui.fth Thu Aug 5 21:03:43 2010 (r1917)
@@ -180,7 +180,6 @@
flash-write ( )
flash-write-disable ( )
;
-
[then]
: ?move-mfg-data ( -- )
@@ -188,43 +187,16 @@
tethered? if
\ Read the manufacturing data from the other FLASH
- \ First try the new location in the e.0000 block
flash-buf mfg-data-offset + /flash-block mfg-data-offset flash-read
-
- \ If there is no mfg data in the e.0000 block, get whatever is in the
- \ last 2K of the 0 block, where the mfg data used to live.
- flash-buf mfg-data-end-offset + invalid-tag? if
- flash-buf mfg-data-offset + /flash-block h# ff erase
-
- flash-buf mfg-data-end-offset + h# 800 - h# 800 ( adr len )
- mfg-data-end-offset h# 800 - ( adr len offset )
- flash-read ( )
- then
exit
then
+ \ Copy the entire block containing the manufacturing data into the
+ \ memory buffer. This make verification easier.
- \ If the system has mfg data in the old place, move it to the new place
- mfg-data-top flash-base h# 1.0000 + = if
- \ Copy just the manufacturing data into the memory buffer; don't
- \ copy the EC bits from the beginning of the block
- mfg-data-range ( adr len )
- flash-buf mfg-data-end-offset + ( adr len ram-adr )
- over - swap ( adr ram-adr' len )
- 2dup 2>r move 2r> ( ram-adr len )
-
- \ Write from the memory buffer to the FLASH
- mfg-data-offset flash-erase-block ( ram-adr len )
- mfg-data-end-offset over - ( ram-adr len offset )
- flash-write ( )
- else
- \ Copy the entire block containing the manufacturing data into the
- \ memory buffer. This make verification easier.
-
- mfg-data-top /flash-block - ( src-adr )
- flash-buf mfg-data-offset + ( src-adr dst-adr )
- /flash-block move ( )
- then
+ mfg-data-top /flash-block - ( src-adr )
+ flash-buf mfg-data-offset + ( src-adr dst-adr )
+ /flash-block move ( )
;
: verify-firmware ( -- )
@@ -235,7 +207,6 @@
[then]
\ Don't verify the block containing the manufacturing data
-
flash-buf mfg-data-end-offset + /flash mfg-data-end-offset verify-flash-range \ Verify last part
;
: write-firmware ( -- )
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