openfirmware
Threads by month
- ----- 2025 -----
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
November 2010
- 5 participants
- 58 discussions

[commit] r2004 - cpu/arm/marvell cpu/arm/mmp2 cpu/arm/olpc/1.75 dev/mmc/sdhci/mv8686 ofw/wifi
by repository service Nov. 3, 2010
by repository service Nov. 3, 2010
Nov. 3, 2010
Author: wmb
Date: Wed Nov 3 10:40:59 2010
New Revision: 2004
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2004
Log:
OLPC XO-1.75 - Added hashing support using Marvell's accelerator hardware, and made the WLAN work.
Added:
cpu/arm/mmp2/hash.fth
cpu/arm/olpc/1.75/sd8686.bth
dev/mmc/sdhci/mv8686/loadpkg.fth
ofw/wifi/hmacsha1.fth
Modified:
cpu/arm/marvell/utmiphy.fth
cpu/arm/olpc/1.75/boardgpio.fth
cpu/arm/olpc/1.75/fw-version.fth
cpu/arm/olpc/1.75/fw.bth
cpu/arm/olpc/1.75/olpc.bth
cpu/arm/olpc/1.75/prefw.bth
cpu/arm/olpc/1.75/sdhci.fth
dev/mmc/sdhci/mv8686/mv8686.bth
ofw/wifi/loadpkg.fth
ofw/wifi/sha1.fth
Modified: cpu/arm/marvell/utmiphy.fth
==============================================================================
--- cpu/arm/marvell/utmiphy.fth Wed Nov 3 10:28:30 2010 (r2003)
+++ cpu/arm/marvell/utmiphy.fth Wed Nov 3 10:40:59 2010 (r2004)
@@ -16,21 +16,36 @@
loop
." PLL calibrate timeout" cr
;
+h# 7e03.ffff value pll-clr \ PLLCALI12, PLLVDD18, PLLVDD12, KVCO, ICP, FBDIV, REFDIV,
+h# 7e01.aeeb value pll-set \ 3 3 3 3 2 ee b
+
+h# 00df.c000 value tx-clr \ TXVDD12, CK60_PHSEL, IMPCAL_VTH
+h# 00c9.4000 value tx-set \ 3 4 5
+
+h# 0001.80f0 value rx-clr \ REG_SQ_LENGTH, RX_SQ_THRESH
+h# 0001.000a value rx-set \ 2 a
+
: init-usb-phy ( -- )
+[ifdef] notdef
+ ." Interacting before USB PHY init." cr
+ ." Change pll-set, tx-set, rx-set as desired then type 'resume'" cr
+ interact
+[then]
+
\ Turn on the USB PHY power
h# 1010.0000 utmi-ctrl regset \ INPKT_DELAY_SOF, PU_REF
h# 2 utmi-ctrl regset \ PLL_PWR_UP
h# 1 utmi-ctrl regset \ PWR_UP
\ Configure the PLLs
- h# 7e03.ffff utmi-pll regclr \ PLLCALI12, PLLVDD18, PLLVDD12, KVCO, ICP, FBDIV, REFDIV,
- h# 7e01.aeeb utmi-pll regset \ 3 3 3 3 2 ee b
+ pll-clr utmi-pll regclr \ PLLCALI12, PLLVDD18, PLLVDD12, KVCO, ICP, FBDIV, REFDIV,
+ pll-set utmi-pll regset \ 3 3 3 3 2 ee b
- h# 00df.c000 utmi-tx regclr \ TXVDD12, CK60_PHSEL, IMPCAL_VTH
- h# 00c9.4000 utmi-tx regset \ 3 4 5
+ tx-clr utmi-tx regclr \ TXVDD12, CK60_PHSEL, IMPCAL_VTH
+ tx-set utmi-tx regset \ 3 4 5
- h# 0001.80f0 utmi-rx regclr \ REG_SQ_LENGTH, RX_SQ_THRESH
- h# 0001.000a utmi-rx regset \ 2 a
+ rx-clr utmi-rx regclr \ REG_SQ_LENGTH, RX_SQ_THRESH
+ rx-set utmi-rx regset \ 2 a
d# 10000 wait-cal
@@ -45,4 +60,5 @@
h# 0000.1000 utmi-tx regclr
d# 1000 wait-cal
+\ ." UTMI calibration done" cr
;
Added: cpu/arm/mmp2/hash.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/mmp2/hash.fth Wed Nov 3 10:40:59 2010 (r2004)
@@ -0,0 +1,175 @@
+\ See license at end of file
+purpose: Hashes (MD5, SHA1, SHA-256) using Marvell hardware acceleration
+
+h# 8101 constant dval
+: dma>hash ( adr len -- )
+ 4 round-up 2 rshift h# d429080c l! ( adr )
+ h# d4290808 l! ( )
+ dval h# d4290800 l! ( )
+\ begin h# d4290814 l@ 1 and until
+;
+: dma-stop h# d4290800 l@ 1 invert and h# d4290800 l! ;
+: swap-axi-bytes ( -- ) h# 5 h# d4290838 l! ; \ Byte swap input and output
+: in-fifo-remain ( -- n ) h# d429083c l@ ;
+\ : in-fifo@ ( -- n ) h# d4290880 l@ ;
+\ : in-fifo! ( n -- ) h# d4290880 l! ;
+\ : out-fifo@ ( -- n ) h# d4290900 l@ ;
+\ : out-fifo! ( n -- ) h# d4290900 l! ;
+
+h# 40 value /hash-block
+d# 20 value /hash-digest
+/hash-block 2* buffer: (hash-buf)
+: hash-buf ( -- adr ) (hash-buf) /hash-block round-up ; \ Aligned
+0 value #hash-buf
+0 value #hashed
+
+: use-sha1 ( -- ) 0 h# d4291800 l! d# 20 to /hash-digest ;
+: use-sha256 ( -- ) 1 h# d4291800 l! d# 32 to /hash-digest ;
+: use-sha224 ( -- ) 2 h# d4291800 l! d# 28 to /hash-digest ;
+: use-md5 ( -- ) 3 h# d4291800 l! d# 16 to /hash-digest ;
+
+: hash-control! ( n -- ) h# d4291804 l! ;
+: hash-go ( -- )
+ 1 h# d4291808 l!
+ begin h# d429180c l@ 1 and until
+ 1 h# d429180c l!
+;
+: set-msg-size ( n -- )
+ 0 h# d429181c l! \ High word of total size
+ h# d4291818 l! \ Low word of total size
+;
+: hash-init ( -- )
+ 1 h# d4290c00 l! \ Select hash (0) for Accelerator A, crossing to direct DMA to it
+ dma-stop
+ 8 hash-control! \ Reset
+ 0 hash-control! \ Unreset
+ 1 hash-control! \ Init digest
+ hash-go
+ 0 to #hash-buf
+ 0 to #hashed
+;
+
+: hash-update-step ( -- )
+ hash-buf /hash-block dma>hash ( )
+ /hash-block h# d4291810 l! ( )
+ 2 hash-control! \ Update digest ( )
+ hash-go ( )
+ dma-stop
+;
+: copy-to-hashbuf ( adr thislen -- )
+ tuck ( adr thislen )
+ hash-buf #hash-buf + swap move ( thislen )
+ #hash-buf + to #hash-buf ( )
+ #hash-buf /hash-block = if ( )
+ hash-update-step ( )
+ 0 to #hash-buf
+ then
+;
+: hash-update ( adr len -- adr' len' )
+ dup #hashed + to #hashed ( adr len )
+ begin dup while ( adr len )
+ 2dup /hash-block #hash-buf - min ( adr len adr this )
+ tuck copy-to-hashbuf ( adr len this )
+ /string ( adr' len' )
+ repeat ( adr len )
+ 2drop
+;
+: hash-final ( -- )
+ #hashed set-msg-size ( )
+ #hash-buf h# d4291810 l! ( )
+ #hash-buf if
+ hash-buf #hash-buf dma>hash ( )
+ then
+ 7 hash-control! \ Final, with hardware padding
+ hash-go
+ dma-stop
+ h# d4291820 /hash-digest
+;
+: hash1 ( adr len -- )
+ hash-init ( adr len )
+ hash-update ( adr' len' )
+ hash-final
+;
+0 [if]
+: hash2 ( adr1 len1 adr2 len2 -- digest$ )
+ third over + >r ( adr1 len1 adr2 len2 r: total-len )
+ hash-init ( adr1 len1 adr2 len2 r: total-len )
+ 2swap hash-update ( adr2 len2 r: total-len )
+ hash-update ( r: total-len )
+ r> hash-done ( digest$ )
+;
+[then]
+
+: md5 ( adr len -- digest$ ) use-md5 hash1 ;
+\ alias $md5digest1 md5
+
+\ : $md5digest2 ( adr1 len1 adr2 len2 -- digest$ ) use-md5 hash2 ;
+
+: sha-256 ( adr len -- digest$ ) use-sha256 hash1 ;
+
+: sha1 ( adr len -- digest$ ) use-sha1 hash1 ;
+
+\ The following interface is for the benefit of ofw/wifi/hmacsha1.fth
+d# 20 constant /sha1-digest
+0 value sha1-digest
+: sha1-init use-sha1 hash-init ;
+: sha1-update hash-update ;
+: sha1-final hash-final drop to sha1-digest ;
+
+: ebg-set ( n -- ) h# d4292c00 l@ or h# d4292c00 l! ;
+: ebg-clr ( n -- ) invert h# d4292c00 l@ and h# d4292c00 l! ;
+
+0 [if]
+\ This is the procedure recommended by the datasheet, but it doesn't work
+: init-entropy-digital ( -- )
+\ h# ffffffff ebg-clr \ All off
+ h# 00008000 ebg-set \ Digital entropy mode
+ h# 00000400 ebg-clr \ RNG reset
+ h# 00000200 ebg-set \ Bias power up
+ d# 400 us
+ h# 00000100 ebg-set \ Fast OSC enable
+ h# 00000080 ebg-set \ Slow OSC enable
+ h# 02000000 ebg-set \ Downsampling ratio
+ h# 00110000 ebg-set \ Slow OSC divider
+ h# 00000400 ebg-set \ RNG unreset
+ h# 00000040 ebg-set \ Post processor enable
+ h# 00001000 ebg-set
+;
+[else]
+\ This procedure works
+: init-entropy-digital ( -- )
+ h# 21117c0 h# d4292c00 l!
+;
+[then]
+
+: random-short ( -- w )
+ begin h# d4292c04 l@ dup 0>= while drop repeat
+ h# ffff and
+;
+: random-long ( -- l )
+ random-short random-short wljoin
+;
+
+\ 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/arm/olpc/1.75/boardgpio.fth
==============================================================================
--- cpu/arm/olpc/1.75/boardgpio.fth Wed Nov 3 10:28:30 2010 (r2003)
+++ cpu/arm/olpc/1.75/boardgpio.fth Wed Nov 3 10:40:59 2010 (r2004)
@@ -18,6 +18,7 @@
d# 33 gpio-dir-out \ EN_MSD_PWR
d# 34 gpio-dir-out \ EN_WLAN_PWR
d# 35 gpio-dir-out \ EN_SD_PWR
+ d# 57 gpio-set \ WLAN_PD#
d# 57 gpio-dir-out \ WLAN_PD#
d# 58 gpio-set \ WLAN_RESET#
d# 58 gpio-dir-out \ WLAN_RESET#
Modified: cpu/arm/olpc/1.75/fw-version.fth
==============================================================================
--- cpu/arm/olpc/1.75/fw-version.fth Wed Nov 3 10:28:30 2010 (r2003)
+++ cpu/arm/olpc/1.75/fw-version.fth Wed Nov 3 10:40:59 2010 (r2004)
@@ -1,3 +1,3 @@
\ The overall firmware revision
macro: FW_MAJOR A
-macro: FW_MINOR 01
+macro: FW_MINOR 02
Modified: cpu/arm/olpc/1.75/fw.bth
==============================================================================
--- cpu/arm/olpc/1.75/fw.bth Wed Nov 3 10:28:30 2010 (r2003)
+++ cpu/arm/olpc/1.75/fw.bth Wed Nov 3 10:40:59 2010 (r2004)
@@ -260,6 +260,19 @@
quit
;
+: newrom
+ " flash! http:\\10.20.0.14\new.rom" eval
+\ " wifi media lab 802.11" eval
+\ " flash http:\\18.85.46.172\new.rom" eval
+;
+: urom " flash! u:\new.rom" eval ;
+: erom " flash! ext:\new.rom" eval ;
+: no-usb-delay " dev /usb false to delay? dend" evaluate ;
+: null-fsdisk
+ " dev /null : write-blocks-start 3drop ; : write-blocks-finish ; dend" evaluate
+ " devalias fsdisk //null" evaluate
+;
+
\ tag-file @ fclose tag-file off
.( --- Saving fw.dic ...)
Modified: cpu/arm/olpc/1.75/olpc.bth
==============================================================================
--- cpu/arm/olpc/1.75/olpc.bth Wed Nov 3 10:28:30 2010 (r2003)
+++ cpu/arm/olpc/1.75/olpc.bth Wed Nov 3 10:40:59 2010 (r2004)
@@ -2,6 +2,7 @@
command: &builder &this
in: ${BP}/cpu/arm/olpc/1.75/build/fw.img
+in: sd8686.bin
build-now
fload ${BP}/cpu/arm/olpc/1.75/fw-version.fth
@@ -76,10 +77,8 @@
" ${BP}/dev/mmc/sdhci/mv8686/build/mv8686.fc" " mv8686" $add-deflated-dropin
[then]
-0 [if]
" sd8686_helper.bin" " helper_sd.bin" $add-deflated-dropin
" sd8686.bin" " sd8686.bin" $add-deflated-dropin
-[then]
" builton.fth" " probe-" $add-dropin
Modified: cpu/arm/olpc/1.75/prefw.bth
==============================================================================
--- cpu/arm/olpc/1.75/prefw.bth Wed Nov 3 10:28:30 2010 (r2003)
+++ cpu/arm/olpc/1.75/prefw.bth Wed Nov 3 10:40:59 2010 (r2004)
@@ -173,18 +173,38 @@
fload ${BP}/ofw/inet/http.fth \ HTTP client
end-support-package
+support-package: cifs
+ fload ${BP}/ofw/fs/cifs/loadpkg.fth
+end-support-package
+devalias smb tcp//cifs
+devalias cifs tcp//cifs
+: op " select smb:\\test:testxxx@10.20.0.14\XTest\hello.txt" eval ;
+: dsmb " dir smb:\\test:testxxx@10.20.0.14\XTest\" eval ;
+
[ifdef] notyet
-fload ${BP}/cpu/x86/pc/olpc/memtest.fth
+fload ${BP}/cpu/arm/olpc/1.75/memtest.fth
[then]
-[ifdef] notyet
+fload ${BP}/cpu/arm/mmp2/hash.fth \ Hashes - SHA1, SHA-256, MD5
+
fload ${BP}/ofw/wifi/wifi-cfg.fth
support-package: supplicant
fload ${BP}/ofw/wifi/loadpkg.fth
end-support-package
-: ofw-ssids ( -- $ ) " OFWSSID" ;
-' ofw-ssids to default-ssids
+: olpc-ssids ( -- $ ) " OLPCOFW" ;
+' olpc-ssids to default-ssids
+
+[ifdef] notyet
+create use-thinmac
+fload ${BP}/cpu/x86/bootascall.fth
+fload ${BP}/cpu/x86/pc/olpc/wifichannel.fth
+fload ${BP}/cpu/x86/pc/olpc/via/nbtx.fth
+fload ${BP}/cpu/x86/pc/olpc/via/nbrx.fth
+fload ${BP}/cpu/x86/pc/olpc/via/blockfifo.fth
+fload ${BP}/cpu/x86/pc/olpc/via/fsupdate.fth
+fload ${BP}/cpu/x86/pc/olpc/via/fsverify.fth
+devalias fsdisk int:0
[then]
fload ${BP}/ofw/inet/sntp.fth
@@ -219,7 +239,6 @@
support-package: nfs
fload ${BP}/ofw/fs/nfs/loadpkg.fth
end-support-package
-
[then]
devalias nfs net//obp-tftp:last//nfs
Added: cpu/arm/olpc/1.75/sd8686.bth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/1.75/sd8686.bth Wed Nov 3 10:40:59 2010 (r2004)
@@ -0,0 +1,31 @@
+purpose: Fetch the firmware for the Marvell 8686 wireless LAN module
+
+command: &builder &this
+build-now
+
+fload ${BP}/cpu/arm/olpc/1.75/wlan-version.fth
+
+" macro: WLAN_FILE lbtf_sdio-${WLAN_VERSION}" expand$ eval
+
+" ${GET_WLAN}" expand$ nip [if]
+ " ${GET_WLAN}" expand$ $sh
+[else]
+" rm -f sd8686.bin sd8686_helper.bin" expand$ $sh
+
+" wget -q http://dev.laptop.org/pub/firmware/libertas/thinfirm/${WLAN_FILE}.bin" expand$ $sh
+" wget -q http://dev.laptop.org/pub/firmware/libertas/thinfirm/${WLAN_FILE}.bin.md5" expand$ $sh
+" md5sum ${WLAN_FILE}.bin | cmp - ${WLAN_FILE}.bin.md5" expand$ $sh
+
+" mv ${WLAN_FILE}.bin sd8686.bin" expand$ $sh
+
+" wget -q http://dev.laptop.org/pub/firmware/libertas/sd8686_helper.bin" expand$ $sh
+" wget -q http://dev.laptop.org/pub/firmware/libertas/sd8686_helper.bin.md5" expand$ $sh
+" md5sum -b sd8686_helper.bin | cmp - sd8686_helper.bin.md5" expand$ $sh
+
+" rm ${WLAN_FILE}.bin.md5 sd8686_helper.bin.md5" expand$ $sh
+[then]
+
+\ This forces the creation of a .log file, so we don't re-fetch
+writing sd8686.version
+" ${WLAN_VERSION}"n" expand$ ofd @ fputs
+ofd @ fclose
Modified: cpu/arm/olpc/1.75/sdhci.fth
==============================================================================
--- cpu/arm/olpc/1.75/sdhci.fth Wed Nov 3 10:28:30 2010 (r2003)
+++ cpu/arm/olpc/1.75/sdhci.fth Wed Nov 3 10:40:59 2010 (r2004)
@@ -24,11 +24,6 @@
: gpio-power-off ( -- ) d# 35 gpio-clr sdhci-card-power-off ;
' gpio-power-off to card-power-off
-\ new-device
-\ 2 encode-int " reg" property
-\ " mv8686" " $load-driver" eval drop
-\ finish-device
-
new-device
1 encode-int " reg" property
fload ${BP}/dev/mmc/sdhci/sdmmc.fth
@@ -38,6 +33,36 @@
end-package
+0 0 " d4280800" " /" begin-package
+
+ fload ${BP}/cpu/arm/olpc/1.75/sdregs.fth
+ fload ${BP}/dev/mmc/sdhci/sdhci.fth
+
+ true to avoid-high-speed?
+
+ hex
+ \ The new clock divisor layout is low 8 bits in [15:8] and high 2 bits in [7:6]
+ \ The resulting 10-bit value is multiplied by 2 to form the divisor for the
+ \ 200 MHz base clock.
+ patch 403 103 card-clock-25 \ n is 4, divisor is 8, clk is 25 MHz
+ patch 203 003 card-clock-50 \ n is 2, divisor is 4, clk is 50 MHz
+ patch 043 8003 card-clock-slow \ n is h# 100 (high 2 bits in [7:6], for divisor of 512 from 200 MHz clock
+
+ ' true to card-inserted?
+
+ : gpio-power-on ( -- ) sdhci-card-power-on d# 34 gpio-set ;
+ ' gpio-power-on to card-power-on
+
+ : gpio-power-off ( -- ) d# 34 gpio-clr sdhci-card-power-off ;
+ ' gpio-power-off to card-power-off
+
+ new-device
+ 1 encode-int " reg" property
+ fload ${BP}/dev/mmc/sdhci/mv8686/loadpkg.fth
+ finish-device
+
+end-package
+
0 0 " d4281000" " /" begin-package
fload ${BP}/cpu/arm/olpc/1.75/sdregs.fth
@@ -73,6 +98,7 @@
stand-init: \ SDHC clocks
h# 41b h# d4282854 l! \ SD0 (external SD) clocks, plus set master clock divisor
+ h# 1b h# d4282858 l! \ SD1 (WLAN) clocks
h# 1b h# d42828e8 l! \ SD2 (internal microSD) clocks
h# 70a h# d4200104 l! \ Clock gating
h# 70a h# d4201104 l! \ Clock gating
Added: dev/mmc/sdhci/mv8686/loadpkg.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dev/mmc/sdhci/mv8686/loadpkg.fth Wed Nov 3 10:40:59 2010 (r2004)
@@ -0,0 +1,7 @@
+fload ${BP}/dev/mmc/sdhci/mv8686/common.fth \ Ethernet common variables and routines
+fload ${BP}/dev/mmc/sdhci/mv8686/ring.fth \ Receive ring management
+fload ${BP}/dev/mmc/sdhci/mv8686/sdio.fth \ SDIO interface routines
+fload ${BP}/dev/mmc/sdhci/mv8686/mv8686.fth \ SDIO I/O interface for Marvell 8686
+fload ${BP}/dev/libertas.fth \ Marvell "Libertas" common code
+fload ${BP}/dev/mmc/sdhci/mv8686/fw8686.fth \ Marvell firmware download for SDIO
+\ fload ${BP}/dev/mmc/sdhci/mv8686/wlan.fth \ External interface methods
Modified: dev/mmc/sdhci/mv8686/mv8686.bth
==============================================================================
--- dev/mmc/sdhci/mv8686/mv8686.bth Wed Nov 3 10:28:30 2010 (r2003)
+++ dev/mmc/sdhci/mv8686/mv8686.bth Wed Nov 3 10:40:59 2010 (r2004)
@@ -10,13 +10,7 @@
FCode-version2
-fload ${BP}/dev/mmc/sdhci/mv8686/common.fth \ Ethernet common variables and routines
-fload ${BP}/dev/mmc/sdhci/mv8686/ring.fth \ Receive ring management
-fload ${BP}/dev/mmc/sdhci/mv8686/sdio.fth \ SDIO interface routines
-fload ${BP}/dev/mmc/sdhci/mv8686/mv8686.fth \ SDIO I/O interface for Marvell 8686
-fload ${BP}/dev/libertas.fth \ Marvell "Libertas" common code
-fload ${BP}/dev/mmc/sdhci/mv8686/fw8686.fth \ Marvell firmware download for SDIO
-\ fload ${BP}/dev/mmc/sdhci/mv8686/wlan.fth \ External interface methods
+fload ${BP}/dev/mmc/sdhci/mv8686/loadpkg.fth
end0
Added: ofw/wifi/hmacsha1.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ ofw/wifi/hmacsha1.fth Wed Nov 3 10:40:59 2010 (r2004)
@@ -0,0 +1,139 @@
+purpose: HMAC-SHA1 used for WPA-PSK
+\ See license at end of file
+
+\ ----------------------------------------------------------------------------
+\ HMAC-SHA1 over data vector (RFC 2104)
+
+d# 64 constant /keypad
+/keypad buffer: keypad
+
+: xor-keypad ( adr c -- )
+ swap /keypad bounds do i c@ over xor i c! loop drop
+;
+: xor-digest ( src dst -- )
+ /sha1-digest bounds do ( src )
+ dup c@ i c@ xor i c! 1+ ( src' )
+ loop drop
+;
+
+: key>keypad ( key$ -- )
+ keypad /keypad erase
+ keypad swap move
+;
+
+\ sha1-digest = SHA1 (K XOR opad, SHA1(K XOR ipad, text))
+\ where K is an n byte key
+\ ipad is 64 0x36
+\ opad is 64 0x5c
+\ text is the data being protected
+\
+/sha1-digest buffer: sha1-idigest \ sha1-idigest = SHA1(K XOR ipad, text))
+/sha1-digest buffer: sha1-tkey
+: ?sha1-reset-key ( passphrase$ -- key$ )
+ dup d# 64 > if \ if len>64, key = SHA1(key)
+ sha1
+ sha1-tkey swap move \ Save new key
+ sha1-tkey /sha1-digest ( key$ )
+ then
+;
+: hmac-sha1 ( datan$..data1$ n key$ -- digest$ )
+ ?sha1-reset-key ( datan$..data1$ n key$' )
+ 2dup key>keypad >r >r ( datan$..data1$ n ) ( R: key$ )
+
+ \ sha1-idigest = SHA1(K XOR ipad, text)
+ keypad h# 36 xor-keypad ( datan$..data1$ n ) ( R: key$ )
+ sha1-init ( datan$..data1$ n ) ( R: key$ )
+ keypad /keypad sha1-update ( datan$..data1$ n ) ( R: key$ )
+ 0 ?do sha1-update loop ( ) ( R: key$ )
+ sha1-final ( ) ( R: key$ )
+ sha1-digest sha1-idigest /sha1-digest move ( ) ( R: key$ )
+
+ \ sha1-digest = SHA1(K XOR opad, sha1-idigest)
+ r> r> key>keypad ( )
+ keypad h# 5c xor-keypad
+ sha1-init
+ keypad /keypad sha1-update
+ sha1-idigest /sha1-digest sha1-update
+ sha1-final
+
+ sha1-digest /sha1-digest ( digest$ )
+;
+
+\ ----------------------------------------------------------------------------
+\ SHA1-based key derivation function (PBKDF2) for IEEE 802.11i.
+\ This function is used to derive PSK for WPA-PSK, described in IEEE
+\ Std 802.11-2004, clause H.4. The main contruction is from PKCS#5 v 2.0.
+
+0 value pbkdf2-cnt
+4 buffer: pbkdf2-cnt-buf
+: pbkdf2-cnt++ ( -- )
+ pbkdf2-cnt 1+ dup to pbkdf2-cnt
+ pbkdf2-cnt-buf be-l!
+;
+
+/sha1-digest buffer: temp \ Last digest
+/sha1-digest buffer: temp2 \ Current digest
+: (pbkdf2-sha1) ( passphrase$ ssid$ -- )
+ 2over >r >r ( passphrase$ ssid$ ) ( R: passphrase$ )
+ pbkdf2-cnt-buf 4 2swap 2 r> r> hmac-sha1 ( passphrase$ digest$ )
+ temp2 swap move ( passphrase$ )
+ d# 4096 1 do
+ sha1-digest temp /sha1-digest move ( passphrase$ )
+ temp /sha1-digest 1 4 pick 4 pick hmac-sha1 ( passphrase$ digest$ )
+ drop temp2 xor-digest ( passphrase$ )
+ loop 2drop ( )
+ temp2 sha1-digest /sha1-digest move
+;
+
+: pbkdf2-sha1 ( passphrase$ ssid$ psk$ -- )
+ 0 to pbkdf2-cnt
+ begin dup 0> while ( passphrase$ ssid$ psk$ )
+ pbkdf2-cnt++ ( passphrase$ ssid$ psk$ )
+ >r >r 2over 2over (pbkdf2-sha1) ( passphrase$ ssid$ ) ( R: psk$ )
+ r> r> 2dup /sha1-digest min sha1-digest -rot move ( passphrase$ ssid$ psk$ )
+ /sha1-digest /string ( passphrase$ ssid$ psk$' )
+ repeat 2drop 2drop 2drop ( )
+;
+
+create zero 0 c,
+create prf-cnt 0 c,
+: zero$ ( -- adr len ) zero 1 ;
+: sha1-prf ( key$ label$ data$ result$ -- )
+ 0 prf-cnt c!
+ begin dup 0> while ( key$ label$ data$ result$ )
+ >r >r ( key$ label$ data$ ) ( R: result$ )
+ prf-cnt 1 2over zero$ ( key$ label$ data$ cnt$ data$ zero$ ) ( R: result$ )
+ 9 pick 9 pick 4 ( key$ label$ data$ cnt$ data$ zero$ label$ n ) ( R: result$ )
+ d# 14 pick d# 14 pick hmac-sha1 ( key$ label$ data$ digest$ ) ( R: result$ )
+ r> r> 2swap 2over rot min move ( key$ label$ data$ result$ )
+ /sha1-digest /string ( key$ label$ data$ result$' )
+ prf-cnt c@ 1+ prf-cnt c! ( key$ label$ data$ result$ )
+ repeat 2drop 2drop 2drop 2drop ( )
+
+;
+
+
+\ 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
Modified: ofw/wifi/loadpkg.fth
==============================================================================
--- ofw/wifi/loadpkg.fth Wed Nov 3 10:28:30 2010 (r2003)
+++ ofw/wifi/loadpkg.fth Wed Nov 3 10:40:59 2010 (r2004)
@@ -4,6 +4,7 @@
[ifdef] 386-assembler
fload ${BP}/ofw/wifi/sha1.fth
[then]
+fload ${BP}/ofw/wifi/hmacsha1.fth
fload ${BP}/ofw/wifi/aes.fth
fload ${BP}/ofw/wifi/md5.fth
fload ${BP}/ofw/wifi/rc4.fth
Modified: ofw/wifi/sha1.fth
==============================================================================
--- ofw/wifi/sha1.fth Wed Nov 3 10:28:30 2010 (r2003)
+++ ofw/wifi/sha1.fth Wed Nov 3 10:40:59 2010 (r2004)
@@ -309,117 +309,6 @@
init-'sha1
-\ ----------------------------------------------------------------------------
-\ HMAC-SHA1 over data vector (RFC 2104)
-
-d# 64 constant /keypad
-/keypad buffer: keypad
-
-: xor-keypad ( adr c -- )
- swap /keypad bounds do i c@ over xor i c! loop drop
-;
-: xor-digest ( src dst -- )
- /sha1-digest bounds do ( src )
- dup c@ i c@ xor i c! 1+ ( src' )
- loop drop
-;
-
-: key>keypad ( key$ -- )
- keypad /keypad erase
- keypad swap move
-;
-
-\ sha1-digest = SHA1 (K XOR opad, SHA1(K XOR ipad, text))
-\ where K is an n byte key
-\ ipad is 64 0x36
-\ opad is 64 0x5c
-\ text is the data being protected
-\
-/sha1-digest buffer: sha1-idigest \ sha1-idigest = SHA1(K XOR ipad, text))
-/sha1-digest buffer: sha1-tkey
-: ?sha1-reset-key ( passphrase$ -- key$ )
- dup d# 64 > if \ if len>64, key = SHA1(key)
- sha1
- sha1-tkey swap move \ Save new key
- sha1-tkey /sha1-digest ( key$ )
- then
-;
-: hmac-sha1 ( datan$..data1$ n key$ -- digest$ )
- ?sha1-reset-key ( datan$..data1$ n key$' )
- 2dup key>keypad >r >r ( datan$..data1$ n ) ( R: key$ )
-
- \ sha1-idigest = SHA1(K XOR ipad, text)
- keypad h# 36 xor-keypad ( datan$..data1$ n ) ( R: key$ )
- sha1-init ( datan$..data1$ n ) ( R: key$ )
- keypad /keypad sha1-update ( datan$..data1$ n ) ( R: key$ )
- 0 ?do sha1-update loop ( ) ( R: key$ )
- sha1-final ( ) ( R: key$ )
- sha1-digest sha1-idigest /sha1-digest move ( ) ( R: key$ )
-
- \ sha1-digest = SHA1(K XOR opad, sha1-idigest)
- r> r> key>keypad ( )
- keypad h# 5c xor-keypad
- sha1-init
- keypad /keypad sha1-update
- sha1-idigest /sha1-digest sha1-update
- sha1-final
-
- sha1-digest /sha1-digest ( digest$ )
-;
-
-\ ----------------------------------------------------------------------------
-\ SHA1-based key derivation function (PBKDF2) for IEEE 802.11i.
-\ This function is used to derive PSK for WPA-PSK, described in IEEE
-\ Std 802.11-2004, clause H.4. The main contruction is from PKCS#5 v 2.0.
-
-0 value pbkdf2-cnt
-4 buffer: pbkdf2-cnt-buf
-: pbkdf2-cnt++ ( -- )
- pbkdf2-cnt 1+ dup to pbkdf2-cnt
- pbkdf2-cnt-buf be-l!
-;
-
-/sha1-digest buffer: temp \ Last digest
-/sha1-digest buffer: temp2 \ Current digest
-: (pbkdf2-sha1) ( passphrase$ ssid$ -- )
- 2over >r >r ( passphrase$ ssid$ ) ( R: passphrase$ )
- pbkdf2-cnt-buf 4 2swap 2 r> r> hmac-sha1 ( passphrase$ digest$ )
- temp2 swap move ( passphrase$ )
- d# 4096 1 do
- sha1-digest temp /sha1-digest move ( passphrase$ )
- temp /sha1-digest 1 4 pick 4 pick hmac-sha1 ( passphrase$ digest$ )
- drop temp2 xor-digest ( passphrase$ )
- loop 2drop ( )
- temp2 sha1-digest /sha1-digest move
-;
-
-: pbkdf2-sha1 ( passphrase$ ssid$ psk$ -- )
- 0 to pbkdf2-cnt
- begin dup 0> while ( passphrase$ ssid$ psk$ )
- pbkdf2-cnt++ ( passphrase$ ssid$ psk$ )
- >r >r 2over 2over (pbkdf2-sha1) ( passphrase$ ssid$ ) ( R: psk$ )
- r> r> 2dup /sha1-digest min sha1-digest -rot move ( passphrase$ ssid$ psk$ )
- /sha1-digest /string ( passphrase$ ssid$ psk$' )
- repeat 2drop 2drop 2drop ( )
-;
-
-create zero 0 c,
-create prf-cnt 0 c,
-: zero$ ( -- adr len ) zero 1 ;
-: sha1-prf ( key$ label$ data$ result$ -- )
- 0 prf-cnt c!
- begin dup 0> while ( key$ label$ data$ result$ )
- >r >r ( key$ label$ data$ ) ( R: result$ )
- prf-cnt 1 2over zero$ ( key$ label$ data$ cnt$ data$ zero$ ) ( R: result$ )
- 9 pick 9 pick 4 ( key$ label$ data$ cnt$ data$ zero$ label$ n ) ( R: result$ )
- d# 14 pick d# 14 pick hmac-sha1 ( key$ label$ data$ digest$ ) ( R: result$ )
- r> r> 2tuck rot min move ( key$ label$ data$ result$ )
- /sha1-digest /string ( key$ label$ data$ result$' )
- prf-cnt c@ 1+ prf-cnt c! ( key$ label$ data$ result$ )
- repeat 2drop 2drop 2drop 2drop ( )
-
-;
-
\ LICENSE_BEGIN
\ Copyright (c) 2007 FirmWorks
1
0
Author: wmb
Date: Wed Nov 3 10:28:30 2010
New Revision: 2003
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2003
Log:
OLPC XO-1.5 - Added internal microSD card to secure XP boot list.
Modified:
cpu/x86/pc/olpc/security.fth
cpu/x86/pc/olpc/xpsecure.fth
Modified: cpu/x86/pc/olpc/security.fth
==============================================================================
--- cpu/x86/pc/olpc/security.fth Wed Nov 3 03:50:32 2010 (r2002)
+++ cpu/x86/pc/olpc/security.fth Wed Nov 3 10:28:30 2010 (r2003)
@@ -1030,7 +1030,7 @@
" dk" find-tag dup if nip nip then
;
-: all-devices$ ( -- list$ ) " sba: disk: ext: int:" ;
+: all-devices$ ( -- list$ ) " ext-sba: int-sba: disk: ext: int:" ;
: secure-startup ( -- )
in-factory? if
Modified: cpu/x86/pc/olpc/xpsecure.fth
==============================================================================
--- cpu/x86/pc/olpc/xpsecure.fth Wed Nov 3 03:50:32 2010 (r2002)
+++ cpu/x86/pc/olpc/xpsecure.fth Wed Nov 3 10:28:30 2010 (r2003)
@@ -6,7 +6,8 @@
fload ${BP}/dev/ramdisk.fth
fload ${BP}/cpu/x86/pc/olpc/sba.fth
-devalias sba ext:0//secure-boot-area//zip-file-system
+devalias ext-sba ext:0//secure-boot-area//zip-file-system
+devalias int-sba int:0//secure-boot-area//zip-file-system
0 value ramdisk-ih \ Instance handle for accessing ramdisk device
1
0
Author: quozl
Date: Wed Nov 3 03:50:32 2010
New Revision: 2002
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2002
Log:
OLPC XO-1.5 - fix fs-update for small files
svn 1994 broke fs-update for files smaller than 2 GIB,
detected by Luna, debugged by James, code by Mitch.
Modified:
ofw/fs/fatfs/read.fth
Modified: ofw/fs/fatfs/read.fth
==============================================================================
--- ofw/fs/fatfs/read.fth Wed Nov 3 02:11:02 2010 (r2001)
+++ ofw/fs/fatfs/read.fth Wed Nov 3 03:50:32 2010 (r2002)
@@ -134,7 +134,10 @@
\ If the last cluster of the file has been read, account for the
\ true length of the file
- fh_length l@ current-position - + ( bytes-valid )
+ current-position fh_length l@ u> if ( bytes-tranferred )
+ current-position fh_length l@ - - ( bytes-valid )
+ then ( bytes-valid )
+
false
;
1
0
Author: quozl
Date: Wed Nov 3 02:11:02 2010
New Revision: 2001
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2001
Log:
OLPC XO-1.5, revert firmware version change from svn 1998
Modified:
cpu/x86/pc/olpc/via/olpc.bth
Modified: cpu/x86/pc/olpc/via/olpc.bth
==============================================================================
--- cpu/x86/pc/olpc/via/olpc.bth Wed Nov 3 00:38:12 2010 (r2000)
+++ cpu/x86/pc/olpc/via/olpc.bth Wed Nov 3 02:11:02 2010 (r2001)
@@ -41,7 +41,7 @@
fload ${BP}/cpu/x86/pc/olpc/via/fw-version.fth
-" macro: FW_VERSION Q4${FW_MAJOR}${FW_MINOR}" expand$ eval
+" macro: FW_VERSION Q3${FW_MAJOR}${FW_MINOR}" expand$ eval
fload ${BP}/cpu/x86/pc/olpc/via/config.fth
1
0
Author: quozl
Date: Wed Nov 3 00:38:12 2010
New Revision: 2000
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2000
Log:
OLPC XO-1.5 - dual boot, enable third SD slot for Windows sometimes.
During Windows boot preparation, determine which SD slot is being used
for the boot, and disable the internal slot only if the external is
being used.
Modified:
cpu/x86/pc/olpc/via/acpi.fth
cpu/x86/pc/olpc/via/addrs.fth
cpu/x86/pc/olpc/via/startpcirestore.fth
Modified: cpu/x86/pc/olpc/via/acpi.fth
==============================================================================
--- cpu/x86/pc/olpc/via/acpi.fth Tue Nov 2 07:23:07 2010 (r1999)
+++ cpu/x86/pc/olpc/via/acpi.fth Wed Nov 3 00:38:12 2010 (r2000)
@@ -315,10 +315,31 @@
\ Geode h# 6000 constant xp-smbus-base
+: loaded-from-external-sd? ( -- flag )
+ " /chosen" find-package drop ( phandle )
+ " bootpath" rot get-package-property abort" No bootpath property"
+ ( adr len )
+ [char] : left-parse-string 2nip ( devname$ )
+ find-package 0= abort" Can't find bootpath device node"
+ ( phandle )
+ " slot-name" rot get-package-property if ( )
+ false \ If no slot-name, say false ( flag )
+ else ( adr len )
+ " external" $= ( flag )
+ then
+;
+
defer more-platform-fixup ' noop to more-platform-fixup
: rm-platform-fixup ( -- )
- \ Disable the internal SD to prevent Windows from making it C:
- h# f9 h# 6099 config-b!
+ loaded-from-external-sd? if
+ \ Disable the internal SD to prevent Windows from making it C:
+ h# f9 h# 6099 config-b!
+ 2
+ else
+ 3
+ then
+ windows-#sd-slots !
+
h# 80 h# 6088 config-b! \ Set timeout clock 0:33Mhz
h# 00 h# 6089 config-b! \ Set max clock to 33Mhz
Modified: cpu/x86/pc/olpc/via/addrs.fth
==============================================================================
--- cpu/x86/pc/olpc/via/addrs.fth Tue Nov 2 07:23:07 2010 (r1999)
+++ cpu/x86/pc/olpc/via/addrs.fth Wed Nov 3 00:38:12 2010 (r2000)
@@ -89,7 +89,8 @@
h# fff40 constant rm-buf \ 8-byte buffer used by BIOS INT 15 AH=C0 for returning config info
h# fff48 constant video-mode-adr \ Saves display mode for resume code
h# fff4c constant windows-mode-adr \ Flag to control Windows-specific resume fixups
-\ h# fff50 Next address available for resume variables
+h# fff50 constant windows-#sd-slots \ Number of SD slots to enable
+\ h# fff54 Next address available for resume variables
h# fff80 constant 'int10-dispatch
Modified: cpu/x86/pc/olpc/via/startpcirestore.fth
==============================================================================
--- cpu/x86/pc/olpc/via/startpcirestore.fth Tue Nov 2 07:23:07 2010 (r1999)
+++ cpu/x86/pc/olpc/via/startpcirestore.fth Wed Nov 3 00:38:12 2010 (r2000)
@@ -28,7 +28,9 @@
al 8000.1029 #) mov
al 8000.2029 #) mov
- f9 6099 config-wb \ Two SD slots (correct for XP, wrong for Linux)
+ 2 # windows-#sd-slots #) cmp = if
+ f9 6099 config-wb \ Two SD slots (correct for XP, wrong for Linux)
+ then
d# 10000 wait-us \ 10 ms delay to let power come on
80 6088 config-wb \ Set timeout clock 0:33Mhz
00 6089 config-wb \ Set max clock to 33Mhz
1
0
Author: wmb
Date: Tue Nov 2 07:23:07 2010
New Revision: 1999
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1999
Log:
XO-1.75 - Check CRC of new firmware image in flash command.
Modified:
cpu/arm/crc32.fth
cpu/arm/olpc/1.75/fw-version.fth
cpu/arm/olpc/1.75/olpc.bth
cpu/arm/olpc/1.75/spiui.fth
Modified: cpu/arm/crc32.fth
==============================================================================
--- cpu/arm/crc32.fth Tue Nov 2 06:52:25 2010 (r1998)
+++ cpu/arm/crc32.fth Tue Nov 2 07:23:07 2010 (r1999)
@@ -24,7 +24,7 @@
eor r4,r4,tos \ r4: crc^byte
and r4,r4,#0xff \ r4: index
ldr r4,[r2,r4,lsl #2] \ lookup in table
- decs r2,1 \ Decrement len
+ decs r3,1 \ Decrement len
eor tos,r4,tos,lsr #8 \ crc' = table_data ^ (crc >> 8)
0= until
c;
Modified: cpu/arm/olpc/1.75/fw-version.fth
==============================================================================
--- cpu/arm/olpc/1.75/fw-version.fth Tue Nov 2 06:52:25 2010 (r1998)
+++ cpu/arm/olpc/1.75/fw-version.fth Tue Nov 2 07:23:07 2010 (r1999)
@@ -1,3 +1,3 @@
\ The overall firmware revision
macro: FW_MAJOR A
-macro: FW_MINOR 00
+macro: FW_MINOR 01
Modified: cpu/arm/olpc/1.75/olpc.bth
==============================================================================
--- cpu/arm/olpc/1.75/olpc.bth Tue Nov 2 06:52:25 2010 (r1998)
+++ cpu/arm/olpc/1.75/olpc.bth Tue Nov 2 07:23:07 2010 (r1999)
@@ -191,7 +191,7 @@
filebuf /rom ofd @ fgets /rom <> abort" Can't read back image"
0 crctab filebuf /rom ($crc) crcbuf !
-/rom h# 2c - ofd @ fseek
+/rom h# 28 - ofd @ fseek
crcbuf /l ofd @ fputs
ofd @ fclose
Modified: cpu/arm/olpc/1.75/spiui.fth
==============================================================================
--- cpu/arm/olpc/1.75/spiui.fth Tue Nov 2 06:52:25 2010 (r1998)
+++ cpu/arm/olpc/1.75/spiui.fth Tue Nov 2 07:23:07 2010 (r1999)
@@ -118,16 +118,6 @@
;
-\ Perform a series of sanity checks on the new firmware image.
-
-: check-firmware-image ( adr len -- adr len )
- dup /flash <> abort" Wrong image length" ( adr len )
- 2dup + h# 40 - ( adr len signature-adr )
- dup " CL1" comp abort" No firmware signature" ( adr len signature-adr )
- ." Firmware: " h# 10 type ( adr len )
- \ XXX add some more sanity checks
-;
-
[ifdef] load-base
: flash-buf load-base ;
: mfg-data-buf load-base /flash + ;
@@ -137,7 +127,7 @@
[then]
0 value file-loaded?
-h# 30 constant crc-offset \ From end (modified in devices.fth for XO 1.5)
+h# 28 constant crc-offset \ From end
: crc ( adr len -- crc ) 0 crctab 2swap ($crc) ;
@@ -153,7 +143,6 @@
r> <> abort" Firmware image has bad internal CRC"
;
-[ifdef] mfg-data-offset
: ?image-valid ( len -- )
/flash <> abort" Image file is the wrong length"
@@ -163,18 +152,15 @@
?crc
+[ifdef] mfg-data-offset
flash-buf mfg-data-offset + /flash-block ['] ?erased catch
abort" Firmware image has data in the manufacturing data block"
[ifdef] use-flash-nvram
flash-buf nvram-offset + /flash-block ['] ?erased catch
abort" Firmware image has data in the NVRAM block"
[then]
-;
-[else]
-: ?image-valid ( len -- )
- drop
-;
[then]
+;
: $get-file ( "filename" -- )
$read-open
@@ -315,6 +301,16 @@
[then]
0 [if]
+\ Perform a series of sanity checks on the new firmware image.
+
+: check-firmware-image ( adr len -- adr len )
+ dup /flash <> abort" Wrong image length" ( adr len )
+ 2dup + h# 40 - ( adr len signature-adr )
+ dup " CL1" comp abort" No firmware signature" ( adr len signature-adr )
+ ." Firmware: " h# 10 type ( adr len )
+ \ XXX add some more sanity checks
+;
+
\ Erase the first block containing the EC microcode. This is dangerous...
: erase-ec ( -- ) 0 flash-erase-block ;
1
0

[commit] r1998 - cpu/arm cpu/arm/Linux cpu/arm/build cpu/arm/marvell cpu/arm/mmp2 cpu/arm/olpc/1.75 cpu/arm/olpc/1.75/build cpu/x86/pc/olpc/via dev dev/olpc/spiflash dev/usb2/hcd/ehci
by repository service Nov. 2, 2010
by repository service Nov. 2, 2010
Nov. 2, 2010
Author: wmb
Date: Tue Nov 2 06:52:25 2010
New Revision: 1998
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1998
Log:
XO-1.75 - USB is sort of working, and the ROM image uses dropin format, versioning, and is checksummed.
Added:
cpu/arm/Linux/inflate.ld
cpu/arm/build/inflate.bin (contents, props changed)
cpu/arm/olpc/1.75/fw-version.fth
cpu/arm/olpc/1.75/olpc.bth
cpu/arm/olpc/1.75/sourceurl.fth
dev/nonmmflash.fth
Modified:
cpu/arm/Linux/Makefile
cpu/arm/basefw.bth
cpu/arm/marvell/tim.fth
cpu/arm/mmp2/sspspi.fth
cpu/arm/olpc/1.75/addrs.fth
cpu/arm/olpc/1.75/build/ (props changed)
cpu/arm/olpc/1.75/build/Makefile
cpu/arm/olpc/1.75/devices.fth
cpu/arm/olpc/1.75/prefw.bth
cpu/x86/pc/olpc/via/olpc.bth
dev/olpc/spiflash/flashif.fth
dev/olpc/spiflash/spiflash.fth
dev/usb2/hcd/ehci/probe.fth
Modified: cpu/arm/Linux/Makefile
==============================================================================
--- cpu/arm/Linux/Makefile Tue Nov 2 06:34:33 2010 (r1997)
+++ cpu/arm/Linux/Makefile Tue Nov 2 06:52:25 2010 (r1998)
@@ -2,7 +2,7 @@
BP=../../..
-CFLAGS = -DARM -mlittle-endian
+CFLAGS = -O -DARM -mlittle-endian
WRTAIL = forth/wrapper
WRDIR = ${BP}/${WRTAIL}
@@ -13,7 +13,7 @@
OBJS = wrapper.o logger.o ${ZIPOBJS}
-all: forth
+all: forth inflate.bin
# Use forth when you just need to run Forth but don't care what
# native instruction set it is on.
@@ -30,6 +30,15 @@
armforth.static: ${OBJS}
${CC} ${CFLAGS} ${LFLAGS} -static -o $@ ${OBJS}
+inflate.lo: ${ZIPDIR}/inflate.c
+ ${CC} -c ${CFLAGS} -O $< -o $@
+
+inflate.o: inflate.lo
+ ${LD} -T inflate.ld $< -o $@
+
+../build/inflate.bin: inflate.o
+ objcopy -O binary $< $@
+
%.o: ${WRDIR}/%.c
${CC} -c ${CFLAGS} $< -o $@
Added: cpu/arm/Linux/inflate.ld
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/Linux/inflate.ld Tue Nov 2 06:52:25 2010 (r1998)
@@ -0,0 +1,6 @@
+SECTIONS
+{
+ . = 0x00000;
+ .text : { *(.text_inflate) }
+ .text_spare : { *(.text) }
+}
Modified: cpu/arm/basefw.bth
==============================================================================
--- cpu/arm/basefw.bth Tue Nov 2 06:34:33 2010 (r1997)
+++ cpu/arm/basefw.bth Tue Nov 2 06:52:25 2010 (r1998)
@@ -86,6 +86,12 @@
\ XXX remove the OS file commands from tools.dic
fload ${BP}/ofw/core/filecmds.fth \ File commands: dir, del, ren, etc.
+\ Defined by CPU core
+h# 1000 to pagesize
+d# 12 to pageshift
+h# 10.0000 constant /section
+h# 4000 constant /page-table
+
[ifndef] no-heads
resident dispose 0 0 set-transize \ true is suppress-transient
Added: cpu/arm/build/inflate.bin
==============================================================================
Binary file. No diff available.
Modified: cpu/arm/marvell/tim.fth
==============================================================================
--- cpu/arm/marvell/tim.fth Tue Nov 2 06:34:33 2010 (r1997)
+++ cpu/arm/marvell/tim.fth Tue Nov 2 06:52:25 2010 (r1998)
@@ -10,6 +10,8 @@
0 value image-size
0 value image-adr
+: tim$ ( -- adr len ) image-adr image-size ;
+
0 value new-image-size
: ?realloc-image ( new-size -- )
dup image-size > if ( new-size )
Modified: cpu/arm/mmp2/sspspi.fth
==============================================================================
--- cpu/arm/mmp2/sspspi.fth Tue Nov 2 06:34:33 2010 (r1997)
+++ cpu/arm/mmp2/sspspi.fth Tue Nov 2 06:52:25 2010 (r1998)
@@ -35,8 +35,6 @@
: ssp-spi-in ( -- b ) 0 ssp-spi-out-in ;
: safe-spi-start
- disable-interrupts
- ignore-power-button
ssp-spi-start
\ The following clears out some glitches so the chip will respond
\ to the ab-id command.
Modified: cpu/arm/olpc/1.75/addrs.fth
==============================================================================
--- cpu/arm/olpc/1.75/addrs.fth Tue Nov 2 06:34:33 2010 (r1997)
+++ cpu/arm/olpc/1.75/addrs.fth Tue Nov 2 06:52:25 2010 (r1998)
@@ -6,9 +6,10 @@
fb-pa constant available-ram-size
+h# 20000 constant dropin-offset \ Offset to dropin driver area in SPI FLASH
+h# 100000 constant /rom \ Total size of SPI FLASH
: (memory?) ( phys -- flag ) total-ram-size u< ;
-' (memory?) to memory?
\ OFW implementation choices
\ h# 1fe0.0000 constant fw-pa
@@ -32,9 +33,3 @@
heap-size constant initial-heap-size
h# 40.0000 constant page-table-pa
-
-\ Defined by CPU core
-h# 1000 to pagesize
-d# 12 to pageshift
-h# 10.0000 constant /section
-h# 4000 constant /page-table
Modified: cpu/arm/olpc/1.75/build/Makefile
==============================================================================
--- cpu/arm/olpc/1.75/build/Makefile Tue Nov 2 06:34:33 2010 (r1997)
+++ cpu/arm/olpc/1.75/build/Makefile Tue Nov 2 06:52:25 2010 (r1998)
@@ -1,4 +1,4 @@
-ROMNAME=ofw
+ROMNAME=olpc
BASEDIR= `(cd ../../../../..; pwd;)`
Modified: cpu/arm/olpc/1.75/devices.fth
==============================================================================
--- cpu/arm/olpc/1.75/devices.fth Tue Nov 2 06:34:33 2010 (r1997)
+++ cpu/arm/olpc/1.75/devices.fth Tue Nov 2 06:52:25 2010 (r1998)
@@ -21,7 +21,7 @@
h# 40 1 uart! \ Marvell-specific UART Enable bit
3 3 uart! \ 8 bits, no parity
7 2 uart! \ Clear and enable FIFOs
- d# 38400 baud
+ d# 115200 baud
;
fload ${BP}/forth/lib/sysuart.fth \ Set console I/O vectors to UART
@@ -100,6 +100,7 @@
fload ${BP}/dev/olpc/spiflash/flashif.fth \ Generic FLASH interface
fload ${BP}/dev/olpc/spiflash/spiif.fth \ Generic low-level SPI bus access
+
fload ${BP}/dev/olpc/spiflash/spiflash.fth \ SPI FLASH programming
: ignore-power-button ; \ XXX implement me
@@ -109,6 +110,26 @@
fload ${BP}/cpu/arm/mmp2/sspspi.fth \ Synchronous Serial Port SPI interface
+\ Create the top-level device node to access the entire boot FLASH device
+0 0 " d4035000" " /" begin-package
+ " flash" device-name
+
+ h# 10.0000 value /device
+ my-address my-space h# 100 reg
+ fload ${BP}/dev/nonmmflash.fth
+end-package
+
+\ Create a node below the top-level FLASH node to accessing the portion
+\ containing the dropin modules
+0 0 " 20000" " /flash" begin-package
+ " dropins" device-name
+
+ h# e0000 constant /device
+ fload ${BP}/dev/subrange.fth
+end-package
+
+devalias dropins /dropins
+
fload ${BP}/cpu/arm/olpc/1.75/spiui.fth \ User interface for SPI FLASH programming
\ fload ${BP}/dev/olpc/spiflash/recover.fth \ XO-to-XO SPI FLASH recovery
: ofw-fw-filename$ " disk:\boot\olpc.rom" ;
@@ -174,32 +195,33 @@
my-address my-space /regs reg
: my-map-in ( len -- adr )
my-space swap " map-in" $call-parent h# 100 + ( adr )
- 3 over h# a8 + rl! ( adr ) \ Force host mode
;
: my-map-out ( adr len -- ) swap h# 100 - swap " map-out" $call-parent ;
false constant has-dbgp-regs?
false constant needs-dummy-qh?
: grab-controller ( config-adr -- error? ) drop false ;
fload ${BP}/dev/usb2/hcd/ehci/loadpkg.fth
+ : otg-set-host-mode 3 h# a8 ehci-reg! ; \ Force host mode
+ ' otg-set-host-mode to set-host-mode
+
end-package
-: usb-power-on ( -- ) 1 gpio-set ;
-: unreset-usb-hub ( -- ) d# 146 gpio-set ;
+\ : usb-power-on ( -- ) 1 gpio-set ;
+: usb-power-on ( -- ) ; \ The EC controls the USB power
+: reset-usb-hub ( -- ) d# 146 gpio-set d# 10 ms d# 146 gpio-set ;
fload ${BP}/cpu/arm/marvell/utmiphy.fth
-: start-usb ( -- )
+: init-usb ( -- )
h# 9 h# d428285c l! \ Enable clock to USB block
- unreset-usb-hub
+ reset-usb-hub
init-usb-phy
;
-0 [if]
stand-init: Init USB Phy
\ usb-power-on \ The EC now controls the USB power
- start-usb
+ init-usb
;
-[then]
fload ${BP}/dev/olpc/mmp2camera/loadpkg.fth
Added: cpu/arm/olpc/1.75/fw-version.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/1.75/fw-version.fth Tue Nov 2 06:52:25 2010 (r1998)
@@ -0,0 +1,3 @@
+\ The overall firmware revision
+macro: FW_MAJOR A
+macro: FW_MINOR 00
Added: cpu/arm/olpc/1.75/olpc.bth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/1.75/olpc.bth Tue Nov 2 06:52:25 2010 (r1998)
@@ -0,0 +1,232 @@
+purpose: Construct the Open Firmware module collection
+
+command: &builder &this
+in: ${BP}/cpu/arm/olpc/1.75/build/fw.img
+build-now
+
+fload ${BP}/cpu/arm/olpc/1.75/fw-version.fth
+
+" macro: FW_VERSION Q4${FW_MAJOR}${FW_MINOR}" expand$ eval
+
+fload ${BP}/cpu/arm/olpc/1.75/config.fth
+
+\ Always re-create the builton.fth file when we make a new rom.img
+fload ${BP}/cpu/x86/pc/builton.bth
+fload ${BP}/cpu/arm/olpc/1.75/sourceurl.fth
+
+fload ${BP}/forth/lib/crc32.fth
+
+hex
+
+: pad-file ( location -- )
+ ofd @ fsize
+ 2dup u< abort" The ROM image is too large"
+ ?do h# ff ofd @ fputc loop
+;
+
+fload ${BP}/cpu/arm/marvell/tim.fth
+
+\ Marvel Trusted Image Module image creation script for
+\ XO-1.75 platform.
+
+tim: 00030102 0 Sky! PXA688
+flash: SPI'10
+timh: TIMH 0 d101f000
+\ Main Processor code loaded into DRAM
+image: OBMI 800 d101c000 ${BP}/cpu/arm/olpc/1.75/dummy.img
+\ Secure Processor code loaded into SRAM
+image: WTMI 1000 d1018000 /scratchbox/users/wmb/home/wmb/cforth.git/build/arm-xo-1.75/shim.img
+image: CFTH 2000 d1000000 /scratchbox/users/wmb/home/wmb/cforth.git/build/arm-xo-1.75/app.img
+\ anonymous: 20000 ${BP}/cpu/arm/olpc/1.75/build/fw.img
+reserved:
+\ fload ${BP}/cpu/arm/olpc/1.75/ddr_samsung_1g.fth
+ term:
+end-reserved
+end-tim
+
+.( --- Saving as )
+" ${FW_VERSION}.rom" expand$ 2dup lower ( adr len )
+2dup type cr ( adr len )
+$new-file
+ tim$ ofd @ fputs
+
+ dropin-offset pad-file
+
+\ Loads the set of drivers that is common to different output formats
+
+ " ${BP}/cpu/arm/build/inflate.bin" " inflate" $add-dropin
+ " fw.img" " firmware" $add-deflated-dropin
+\ " fw.img" " firmware" $add-dropin
+
+\ " ${BP}/dev/usb2/hcd/ehci/build/ehci.fc" " class0c0320" $add-deflated-dropin
+ " ${BP}/dev/usb2/device/hub/build/hub.fc" " usb,class9" $add-deflated-dropin
+ " ${BP}/dev/usb2/device/generic/build/generic.fc" " usbdevice" $add-deflated-dropin
+ " ${BP}/dev/usb2/device/net/build/usbnet.fc" " usbnet" $add-deflated-dropin
+ " ${BP}/dev/usb2/device/keyboard/build/usbkbd.fc" " usb,class3,1" $add-deflated-dropin
+ " ${BP}/dev/usb2/device/serial/build/usbserial.fc" " usbserial" $add-deflated-dropin
+ " ${BP}/dev/usb2/device/storage/build/usbstorage.fc" " usbstorage" $add-deflated-dropin
+
+
+0 [if]
+ " ${BP}/dev/mmc/sdhci/build/sdhci2.fc" " class080501" $add-deflated-dropin
+[then]
+
+0 [if]
+ " ${BP}/dev/mmc/sdhci/build/sdmmc.fc" " sdmmc" $add-deflated-dropin
+ " ${BP}/dev/mmc/sdhci/mv8686/build/mv8686.fc" " mv8686" $add-deflated-dropin
+[then]
+
+0 [if]
+ " sd8686_helper.bin" " helper_sd.bin" $add-deflated-dropin
+ " sd8686.bin" " sd8686.bin" $add-deflated-dropin
+[then]
+
+ " builton.fth" " probe-" $add-dropin
+
+0 [if]
+ " ${BP}/clients/emacs/x86/emacs" " emacs" $add-deflated-dropin
+ " ${BP}/clients/emacs/x86/emacs.rc" " emacs.rc" $add-deflated-dropin
+ " ${BP}/clients/emacs/emacs.hlp" " emacs.hlp" $add-deflated-dropin
+[then]
+
+ " ${BP}/ofw/fcode/memtest.fth" " memtest.fth" $add-deflated-dropin
+
+0 [if]
+ " ${BP}/dev/hdaudio/build/hdaudio.fc" " class040300" $add-deflated-dropin
+
+ " ${BP}/ofw/inet/telnetd.fth" " telnetd" $add-deflated-dropin
+[then]
+
+0 [if]
+\ " ${BP}/cpu/x86/pc/olpc/images/warnings.565" " warnings.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/lightdot.565" " lightdot.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/yellowdot.565" " yellowdot.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/darkdot.565" " darkdot.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/lock.565" " lock.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/unlock.565" " unlock.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/plus.565" " plus.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/minus.565" " minus.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/x.565" " x.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/sad.565" " sad.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/bigdot.565" " bigdot.565" $add-deflated-dropin
+
+ " ${BP}/cpu/x86/pc/olpc/images/check.565" " check.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/xogray.565" " xogray.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/ethernet.565" " ethernet.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/usbkey.565" " disk.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/wireless.565" " wlan.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/laptop.565" " int.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/sd.565" " ext.565" $add-deflated-dropin
+[then]
+
+0 [if]
+ " ${BP}/ofw/termemu/15x30pc.psf" " font" $add-deflated-dropin
+[then]
+
+0 [if]
+ " memtest" " memtest" $add-deflated-dropin
+[then]
+
+0 [if]
+ " verify.img" " verify" $add-deflated-dropin
+ " os.public" " ospubkey" $add-dropin \ Incompressible
+ " fw.public" " fwpubkey" $add-dropin \ Incompressible
+ " fs.public" " fspubkey" $add-dropin \ Incompressible
+ " lease.public" " leasepubkey" $add-dropin \ Incompressible
+ " developer.public" " develpubkey" $add-dropin \ Incompressible
+[then]
+ " sourceurl" " sourceurl" $add-dropin
+
+0 [if]
+ " ${BP}/cpu/x86/pc/olpc/images/Edge1-8k-EQ-Comp-Amp-Short.wav" " splash" $add-deflated-dropin
+
+ \ icons for mfg test gui
+ " testicons/play.565" " play.565" $add-deflated-dropin
+ " testicons/quit.565" " quit.565" $add-deflated-dropin
+ " testicons/cpu.565" " cpu.565" $add-deflated-dropin
+ " testicons/spi.565" " spi.565" $add-deflated-dropin
+ " testicons/ram.565" " ram.565" $add-deflated-dropin
+ " testicons/sdcard.565" " sdcard.565" $add-deflated-dropin
+ " testicons/keyboard.565" " keyboard.565" $add-deflated-dropin
+ " testicons/display.565" " display.565" $add-deflated-dropin
+ " testicons/touchpad.565" " touchpad.565" $add-deflated-dropin
+ " testicons/audio.565" " audio.565" $add-deflated-dropin
+ " testicons/usb.565" " usb.565" $add-deflated-dropin
+ " testicons/battery.565" " battery.565" $add-deflated-dropin
+ " testicons/camera.565" " camera.565" $add-deflated-dropin
+ " testicons/wifi.565" " wifi.565" $add-deflated-dropin
+ " testicons/clock.565" " clock.565" $add-deflated-dropin
+ " testicons/timer.565" " timer.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/bigx.di" $add-file
+ " ${BP}/cpu/x86/pc/olpc/images/bigcheck.di" $add-file
+ " ${BP}/cpu/x86/pc/olpc/images/leds.di" $add-file
+ " ${BP}/cpu/x86/pc/olpc/images/ebook.di" $add-file
+
+ " ${BP}/cpu/x86/pc/olpc/via/build/nandblaster15_rx.bin" " nb15_rx" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/via/build/nandblaster_tx.bin" " nb_tx" $add-deflated-dropin
+
+ " ${BP}/cpu/x86/pc/olpc/images/winlogo.565" " winlogo.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/tux.565" " tux.565" $add-deflated-dropin
+ " ${BP}/cpu/x86/pc/olpc/images/settings.565" " settings.565" $add-deflated-dropin
+[then]
+
+.( Dropin top is ) ofd @ fsize .x cr
+
+/rom pad-file
+
+\ Insert the revision signature
+/rom h# 40 - ofd @ fseek
+h# 10 buffer: signature
+signature h# 10 blank
+" CL1" signature swap move
+" ${FW_VERSION}" expand$ signature 6 + swap move
+" Q4${FW_MAJOR}" expand$ signature d# 13 + swap move
+signature h# 10 ofd @ fputs
+
+/l buffer: crcbuf
+/rom buffer: filebuf
+
+\ Read the entire image, compute the CRC, and store it h# 28 from the end
+0 ofd @ fseek
+filebuf /rom ofd @ fgets /rom <> abort" Can't read back image"
+0 crctab filebuf /rom ($crc) crcbuf !
+
+/rom h# 2c - ofd @ fseek
+crcbuf /l ofd @ fputs
+
+ofd @ fclose
+
+\ Creating olpc.version serves two purposes:
+\ a) It reports the firmware revision for use by external scripts
+\ b) It provides an olpc.* artifact for the builder dependency management.
+
+writing olpc.version
+" ${FW_VERSION}" expand$ 2dup lower ofd @ fputs
+ofd @ fclose
+
+
+
+\ 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/arm/olpc/1.75/prefw.bth
==============================================================================
--- cpu/arm/olpc/1.75/prefw.bth Tue Nov 2 06:34:33 2010 (r1997)
+++ cpu/arm/olpc/1.75/prefw.bth Tue Nov 2 06:52:25 2010 (r1998)
@@ -12,6 +12,7 @@
' noop is include-hook
fload ${BP}/cpu/arm/olpc/1.75/config.fth
+' (memory?) to memory?
: headerless ; : headers ; : headerless0 ;
Added: cpu/arm/olpc/1.75/sourceurl.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/1.75/sourceurl.fth Tue Nov 2 06:52:25 2010 (r1998)
@@ -0,0 +1,8 @@
+\ Make a file containing the URL of the source code
+
+show-rebuilds? false to show-rebuilds? \ We don't need to see these commands
+
+" svn info ../../../../.. | grep URL: | cut -d ' ' -f 2 | tr \\n ' ' >sourceurl" $sh
+" svnversion -n ../../../../.. >>sourceurl" $sh
+
+to show-rebuilds?
Modified: cpu/x86/pc/olpc/via/olpc.bth
==============================================================================
--- cpu/x86/pc/olpc/via/olpc.bth Tue Nov 2 06:34:33 2010 (r1997)
+++ cpu/x86/pc/olpc/via/olpc.bth Tue Nov 2 06:52:25 2010 (r1998)
@@ -41,7 +41,7 @@
fload ${BP}/cpu/x86/pc/olpc/via/fw-version.fth
-" macro: FW_VERSION Q3${FW_MAJOR}${FW_MINOR}" expand$ eval
+" macro: FW_VERSION Q4${FW_MAJOR}${FW_MINOR}" expand$ eval
fload ${BP}/cpu/x86/pc/olpc/via/config.fth
Added: dev/nonmmflash.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dev/nonmmflash.fth Tue Nov 2 06:52:25 2010 (r1998)
@@ -0,0 +1,168 @@
+purpose: Package for non-memory-mapped FLASH ROM device
+\ See license at end of file
+
+headerless
+0 value open-count
+0 instance value seek-ptr
+
+: clip-size ( adr len -- len' adr len' )
+ seek-ptr + /device min seek-ptr - ( adr len' )
+ tuck
+;
+: update-ptr ( len' -- len' ) dup seek-ptr + to seek-ptr ;
+
+headers
+external
+: seek ( d.offset -- status )
+ 0<> over /device u> or if drop true exit then \ Seek offset too big
+ to seek-ptr
+ false
+;
+
+: open ( -- flag )
+ \ This lets us open the node during compilation
+ standalone? 0= if true exit then
+
+ open-count dup 1+ to open-count 0= if ( )
+ flash-open ( )
+ then ( )
+ 0 to seek-ptr ( )
+ true ( true )
+;
+: close ( -- )
+ \ This lets us open the node during compilation
+ standalone? 0= if exit then
+
+ open-count dup 1- 0 max to open-count ( old-count )
+ 1 = if then
+;
+: size ( -- d.size ) /device u>d ;
+: read ( adr len -- actual )
+ clip-size ( len' adr len' )
+ seek-ptr flash-read ( len' )
+ update-ptr ( len' )
+;
+
+0 [if]
+\ Write support is complicated by the need to erase before
+\ writing and the possibly-different erase and write granularity.
+\
+\ For NOR FLASH, where you can write as many times as you want
+\ while turning 1's into 0's, the algorithm is:
+\
+\ Break the entire write range into pieces each contained in one
+\ erase unit. For each piece:
+\
+\ Compare the existing and new contents to see if the unit needs erasing
+\
+\ If no bits need to go from 0 to 1, erase is unnecessary, so just write.
+\ (It's a little more complicated if the write granularity is >1 byte.)
+\
+\ Otherwise, copy the existing contents of the erase unit to a buffer,
+\ merge in the new data, erase, then write back the buffer.
+[then]
+
+: left-in-block ( len offset -- #left )
+ \ Determine how many bytes are left in the page containing offset
+ /flash-block swap /flash-block 1- and - ( len left-in-page )
+ min ( #left )
+;
+
+0 value /tmp
+0 value 'tmp
+: must-erase? ( adr len -- flag )
+ dup to /tmp
+ /tmp alloc-mem to 'tmp ( adr len )
+ 'tmp /tmp seek-ptr flash-read ( adr len )
+ 'tmp swap 0 ?do ( adr dev-adr )
+ over i + c@ over i + c@ ( adr dev-adr new-byte old-byte )
+ \ Must erase if a bit in old-byte is 0 and that bit in new-byte is 1
+ invert and if ( adr dev-adr )
+ 'tmp /tmp free-mem ( adr dev-adr )
+ 2drop true unloop exit ( -- flag )
+ then ( adr dev-adr )
+ loop ( adr dev-adr )
+ 'tmp /tmp free-mem ( adr dev-adr )
+ 2drop false ( flag )
+;
+
+: erase+write ( adr len -- )
+ dup /flash-block = if
+ \ If we are going to overwrite the entire block, there's no need to
+ \ preserve the old data. This can only happen if we are already
+ \ aligned on an erase block boundary.
+ seek-ptr flash-erase-block ( adr len )
+ seek-ptr flash-write ( )
+ else
+ \ Allocate a buffer to save the old block contents
+ /flash-block alloc-mem >r ( adr len )
+
+ seek-ptr /flash-block round-down ( adr len block-start )
+
+ \ Copy existing data from FLASH block to the buffer
+ r@ /flash-block 2 pick flash-read ( adr len block-start )
+
+ \ Merge new bytes into the buffer
+ -rot ( block-start adr len )
+ seek-ptr /flash-block mod ( block-start adr len buf-offset )
+ r@ + swap move ( block-start )
+
+ \ Erase the block and rewrite it from the buffer
+ dup flash-erase-block ( block-start )
+ r@ /flash-block rot flash-write ( )
+
+ \ Release the buffer
+ r> /flash-block free-mem
+ then
+;
+
+: handle-block ( adr len -- adr' len' )
+ dup seek-ptr left-in-block ( adr len #left )
+ >r ( adr len r: #left )
+ over r@ must-erase? if ( adr len r: #left )
+ over r@ erase+write ( adr len r: #left )
+ else ( adr len r: #left )
+ over r@ seek-ptr flash-write ( adr len r: #left )
+ then ( adr len r: #left )
+ seek-ptr r@ + to seek-ptr ( adr len r: #left )
+ r> /string ( adr' len' )
+;
+
+: write ( adr len -- #written )
+ flash-write-enable
+ tuck ( len adr len )
+ begin dup while handle-block repeat ( len adr' remain' )
+ 2drop ( len )
+ flash-write-disable
+;
+
+\ These permit subordinate nodes for subranges of the device, for
+\ purposes like dropin driver collections, configuration variables, etc.
+1 " #address-cells" integer-property
+
+: decode-unit ( adr len -- phys ) push-hex $number if 0 then pop-base ;
+: encode-unit ( phys -- adr len ) push-hex (u.) pop-base ;
+
+\ 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: dev/olpc/spiflash/flashif.fth
==============================================================================
--- dev/olpc/spiflash/flashif.fth Tue Nov 2 06:34:33 2010 (r1997)
+++ dev/olpc/spiflash/flashif.fth Tue Nov 2 06:52:25 2010 (r1998)
@@ -1,6 +1,7 @@
\ See license at end of file
purpose: Generic interface for FLASH programming operations
+defer flash-open ( -- )
defer flash-write-enable ( -- )
defer flash-write-disable ( -- )
defer flash-write ( adr len offset -- )
Modified: dev/olpc/spiflash/spiflash.fth
==============================================================================
--- dev/olpc/spiflash/spiflash.fth Tue Nov 2 06:34:33 2010 (r1997)
+++ dev/olpc/spiflash/spiflash.fth Tue Nov 2 06:52:25 2010 (r1998)
@@ -298,12 +298,20 @@
then
;
-: spi-flash-write-enable ( -- ) spi-start spi-identify .spi-id cr ;
+
+: spi-flash-open ( -- )
+ \ One retry
+ spi-start ['] spi-identify catch if
+ spi-start spi-identify
+ then
+;
+: spi-flash-write-enable ( -- ) flash-open .spi-id cr ;
: use-spi-flash-read ( -- ) ['] read-spi-flash to flash-read ;
\ Install the SPI FLASH versions as their implementations.
: use-spi-flash ( -- )
+ ['] spi-flash-open to flash-open
['] spi-flash-write-enable to flash-write-enable
['] spi-reprogrammed to flash-write-disable
['] write-spi-flash to flash-write
Modified: dev/usb2/hcd/ehci/probe.fth
==============================================================================
--- dev/usb2/hcd/ehci/probe.fth Tue Nov 2 06:34:33 2010 (r1997)
+++ dev/usb2/hcd/ehci/probe.fth Tue Nov 2 06:52:25 2010 (r1998)
@@ -119,6 +119,9 @@
init-extra
;
+\ Some OTG controllers need to do something after reset-usb to go into host mode
+defer set-host-mode ' noop to set-host-mode
+
\ This is a sneaky way to determine if the hardware has been turned off without the software's knowledge
: suspended? ( -- flag ) asynclist@ 0= qh-ptr 0<> and ;
@@ -138,6 +141,7 @@
then
0 ehci-reg@ h# ff and to op-reg-offset
reset-usb
+ set-host-mode
do-resume
then
suspended? if do-resume then
1
0
Author: quozl
Date: Tue Nov 2 06:34:33 2010
New Revision: 1997
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1997
Log:
OLPC XO-1.5 - dual boot, use rocker down key for menu, restore pretty boot
Modified:
cpu/x86/pc/olpc/gui.fth
cpu/x86/pc/olpc/via/fw.bth
Modified: cpu/x86/pc/olpc/gui.fth
==============================================================================
--- cpu/x86/pc/olpc/gui.fth Sat Oct 30 06:53:25 2010 (r1996)
+++ cpu/x86/pc/olpc/gui.fth Tue Nov 2 06:34:33 2010 (r1997)
@@ -362,6 +362,7 @@
\ === Stuff moved from security.fth ===
: visible dcon-unfreeze text-on ;
+: invisible text-off dcon-freeze ;
0 0 2value next-icon-xy
0 0 2value next-dot-xy
Modified: cpu/x86/pc/olpc/via/fw.bth
==============================================================================
--- cpu/x86/pc/olpc/via/fw.bth Sat Oct 30 06:53:25 2010 (r1996)
+++ cpu/x86/pc/olpc/via/fw.bth Tue Nov 2 06:34:33 2010 (r1997)
@@ -647,8 +647,8 @@
[then]
: ?boot-menu ( -- )
- button-rotate game-key? if
- protect-fw visible bootmenu
+ rocker-down game-key? if
+ protect-fw visible bootmenu invisible show-child
then
;
1
0