Author: quozl
Date: Sat Jul 23 05:55:32 2011
New Revision: 2394
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2394
Log:
OLPC XO-1.5 - new EC firmware from Richard #11021
Modified:
cpu/x86/pc/olpc/via/ec-version.fth
Modified: cpu/x86/pc/olpc/via/ec-version.fth
==============================================================================
--- cpu/x86/pc/olpc/via/ec-version.fth Sat Jul 23 01:32:04 2011 (r2393)
+++ cpu/x86/pc/olpc/via/ec-version.fth Sat Jul 23 05:55:32 2011 (r2394)
@@ -1,5 +1,5 @@
\ The EC microcode
-macro: EC_VERSION 2_2_6
+macro: EC_VERSION 2_2_7
\ Alternate command for getting EC microcode, for testing new versions.
\ Temporarily uncomment the line and modify the path as necessary
Author: wmb
Date: Tue Jul 19 15:08:06 2011
New Revision: 2392
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2392
Log:
OLPC XO-1.75 - Added numeric display of startup progress messages. Press the check key to see them - or CForth will automatically make them visible if OFW fails to take over the display after a few seconds.
Added:
cpu/arm/olpc/fbmsg.fth
cpu/arm/olpc/fbnums.fth
cpu/arm/olpc/numdot.fth
Modified:
cpu/arm/olpc/1.75/fw.bth
cpu/arm/olpc/resetvec.bth
Modified: cpu/arm/olpc/1.75/fw.bth
==============================================================================
--- cpu/arm/olpc/1.75/fw.bth Tue Jul 19 14:48:52 2011 (r2391)
+++ cpu/arm/olpc/1.75/fw.bth Tue Jul 19 15:08:06 2011 (r2392)
@@ -11,6 +11,10 @@
\ ' $report-name is include-hook
\ ' noop is include-hook
+fb-pa constant display-pa
+fload ${BP}/cpu/arm/olpc/fbnums.fth
+fload ${BP}/cpu/arm/olpc/fbmsg.fth
+
fload ${BP}/cpu/arm/olpc/1.75/devices.fth
[ifndef] virtual-mode
@@ -195,10 +199,12 @@
fload ${BP}/cpu/arm/mmp2/keypad.fth
[ifndef] cl2-a1
+[ifdef] notdef \ CForth turns on the keypad; resetting it makes it not work
stand-init: keypad
keypad-on
8 keypad-direct-mode
;
+[then]
: keypad-bit ( n keypad out-mask key-mask -- n' keypad )
third invert and if ( n keypad out-mask )
rot or swap ( n' keypad )
Added: cpu/arm/olpc/fbmsg.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/fbmsg.fth Tue Jul 19 15:08:06 2011 (r2392)
@@ -0,0 +1,45 @@
+\ See license at end of file
+purpose: Put message codes out on the frame buffer
+
+h# 40 value the-debug-code
+: next-debug-code ( -- n )
+ the-debug-code dup 1+ ( n )
+ dup h# f and h# a = if 6 + then ( n ) \ Use BCD
+ to the-debug-code
+;
+
+: show-debug-code ( adr len code# -- )
+ ." Msg#: " push-hex <# u# u# u#> type pop-base space type cr
+;
+: put-fbmsg ( msg$ -- )
+ next-debug-code dup >r show-debug-code r> ( adr len b )
+ postpone literal postpone puthex ( adr len )
+;
+
+\ Automatically insert port80 codes in named stand-init: words
+: fbmsg ( msg$ -- msg$ ) 2dup put-fbmsg ;
+' fbmsg to check-message
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2011 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
Added: cpu/arm/olpc/fbnums.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/fbnums.fth Tue Jul 19 15:08:06 2011 (r2392)
@@ -0,0 +1,88 @@
+\ See license at end of file
+purpose: Numeric display of startup progress
+
+\ Display 2-digit hex or decimal numbers using a simple 3x5 font
+\ in a small framebuffer. The framebuffer is assumed to be 4 bits/pixel,
+\ 12 pixels per line, with a pitch of 6 bytes. The 3x5 font is
+\ equivalent to a 7-segment display.
+
+\ There are only 4 distinct row values in a 7-segment display -
+\ horizontal bar , left vertical bar, right vertical bar, and
+\ left+right vertical bars. The patterns below encode those
+\ cases as pixel values.
+\ The frame buffer is assumed to be little-endian, i.e. the
+\ least-significant nibble of a shortword displays in the
+\ leftmost pixel of the group.
+\ 0 is black (foreground), while f is white (background)
+\ The 3x5 font is displayed in a 4-wide cell, so each row
+\ has a white (f, background) leftmost pixel.
+
+create patterns
+h# ff0f w, \ 0 - dot on the right
+h# 0fff w, \ 1 - dot on the left
+h# 0f0f w, \ 2 - dots on left and right
+h# 000f w, \ 3 - dots all the way across
+
+\ Each digit in the base-4 numerals below indexes one of the four patterns.
+\ The rightmost (least significant) digit is the topmost line of the 5-high
+\ glyph.
+
+create numerals
+4 base !
+32223 w, \ 0
+11111 w, \ 1
+30313 w, \ 2
+31313 w, \ 3
+11322 w, \ 4
+31303 w, \ 5
+32303 w, \ 6
+11113 w, \ 7
+32323 w, \ 8
+31323 w, \ 9
+22323 w, \ a
+32300 w, \ b
+30003 w, \ c
+32311 w, \ d
+30303 w, \ e
+00303 w, \ f
+hex
+
+6 constant fb-pitch
+: putdig ( n pos -- )
+ numerals rot wa+ w@ ( pos glyph )
+ \ Vertical offset by 2 lines (fb-pitch 2*), horizontal by pos character cells
+ display-pa fb-pitch 2* + rot wa+ ( glyph fb-adr )
+ 5 0 do ( glyph fb-adr )
+ over 3 and ( glyph fb-adr pattern# )
+ patterns swap wa+ w@ ( glyph fb-adr pattern )
+ over w! ( glyph fb-adr )
+ swap 2/ 2/ swap fb-pitch + ( glyph' fb-adr' )
+ loop ( glyph fb-adr )
+ 2drop ( )
+;
+: putdec ( n -- ) d# 10 /mod 0 putdig 1 putdig ;
+: puthex ( n -- ) d# 16 /mod 0 putdig 1 putdig ;
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2011 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
Added: cpu/arm/olpc/numdot.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/arm/olpc/numdot.fth Tue Jul 19 15:08:06 2011 (r2392)
@@ -0,0 +1,259 @@
+\ See license at end of file
+purpose: Numeric display of startup progress in ARM assembly language
+
+\ This is an ARM assembly language version of the 3x5 font numeric display
+\ code, a high-level version of which is in fbnums.fth . This assembly
+\ language version uses a less-compact font encoding, because the compact
+\ encoding in fbnums.fth requires more registers to display. This version
+\ trades size for reduced register use - it needs only R0-R3 and LR, so it
+\ can be called with less concern for the register use of the calling point,
+\ and without needing a stack. The value of the "no stack" attribute is
+\ questionable, since the frame buffer used to display the number is likely
+\ to be in memory, so if memory doesn't work, this feature probably won't
+\ work in any case.
+
+label fb-adr-loc \ Frame buffer address
+fb-pa ,
+end-code
+
+label numerals
+hex
+\ 0
+ffff w,
+000f w,
+0f0f w,
+0f0f w,
+0f0f w,
+000f w,
+
+\ 1
+ffff w,
+0fff w,
+0fff w,
+0fff w,
+0fff w,
+0fff w,
+
+\ 2
+ffff w,
+000f w,
+0fff w,
+000f w,
+ff0f w,
+000f w,
+
+\ 3
+ffff w,
+000f w,
+0fff w,
+000f w,
+0fff w,
+000f w,
+
+\ 4
+ffff w,
+0f0f w,
+0f0f w,
+000f w,
+0fff w,
+0fff w,
+
+\ 5
+ffff w,
+000f w,
+ff0f w,
+000f w,
+0fff w,
+000f w,
+
+\ 6
+ffff w,
+000f w,
+ff0f w,
+000f w,
+0f0f w,
+000f w,
+
+\ 7
+ffff w,
+000f w,
+0fff w,
+0fff w,
+0fff w,
+0fff w,
+
+\ 8
+ffff w,
+000f w,
+0f0f w,
+000f w,
+0f0f w,
+000f w,
+
+\ 9
+ffff w,
+000f w,
+0f0f w,
+000f w,
+0fff w,
+000f w,
+
+\ a
+ffff w,
+000f w,
+0f0f w,
+000f w,
+0f0f w,
+0f0f w,
+
+\ b
+ffff w,
+ff0f w,
+ff0f w,
+000f w,
+0f0f w,
+000f w,
+
+\ c
+ffff w,
+000f w,
+ff0f w,
+ff0f w,
+ff0f w,
+000f w,
+
+\ d
+ffff w,
+0fff w,
+0fff w,
+000f w,
+0f0f w,
+000f w,
+
+\ e
+ffff w,
+000f w,
+ff0f w,
+000f w,
+ff0f w,
+000f w,
+
+\ f
+ffff w,
+000f w,
+ff0f w,
+000f w,
+ff0f w,
+ff0f w,
+
+end-code
+
+[ifdef] test-me
+code puthex ( r0: nn \ kills: r1-r3 )
+ mov r0,tos
+[else]
+label puthex ( r0: nn \ kills: r1-r3 )
+[then]
+
+ mov r3,r0,lsr #4 \ r3: Hidigit
+ and r3,r3,#0xf \ r3: Hidigit
+
+ sub r2,pc,`here 8 + numerals - #` \ adr r2,=numerals r2: 'glyphs
+
+ add r2,r2,r3,lsl #3 \ r2: 'glyph
+ add r2,r2,r3,lsl #2 \ r2: 'glyph
+
+ ldr r3,[pc,`fb-adr-loc here 8 + - #`] \ r3: 'fb
+
+ ldr r1,[r2],#4 \ r1: bits
+ strh r1,[r3,#6]! \ Write halfword
+ mov r1,r1,lsr #16
+ strh r1,[r3,#6]! \ Write halfword
+
+ ldr r1,[r2],#4 \ r1: bits
+ strh r1,[r3,#6]! \ Write halfword
+ mov r1,r1,lsr #16
+ strh r1,[r3,#6]! \ Write halfword
+
+ ldr r1,[r2],#4 \ r1: bits
+ strh r1,[r3,#6]! \ Write halfword
+ mov r1,r1,lsr #16
+ strh r1,[r3,#6]! \ Write halfword
+
+ and r3,r0,#0xf \ r3: Lodigit
+
+ sub r2,pc,`here 8 + numerals - #` \ adr r2,=numerals r2: 'glyphs
+ \ r2 = numerals + 12*r3
+ add r2,r2,r3,lsl #3 \ r2: 'glyph
+ add r2,r2,r3,lsl #2 \ r2: 'glyph
+
+ ldr r3,[pc,`fb-adr-loc here 8 + - #`] \ r3: 'fb
+ inc r3,#2 \ r3: 'fb
+
+ ldr r1,[r2],#4 \ r1: bits
+ strh r1,[r3,#6]! \ Write halfword
+ mov r1,r1,lsr #16
+ strh r1,[r3,#6]! \ Write halfword
+
+ ldr r1,[r2],#4 \ r1: bits
+ strh r1,[r3,#6]! \ Write halfword
+ mov r1,r1,lsr #16
+ strh r1,[r3,#6]! \ Write halfword
+
+ ldr r1,[r2],#4 \ r1: bits
+ strh r1,[r3,#6]! \ Write halfword
+ mov r1,r1,lsr #16
+ strh r1,[r3,#6]! \ Write halfword
+
+[ifdef] test-me
+ pop tos,sp
+c;
+[else]
+ mov pc,lr
+end-code
+[then]
+
+0 [if]
+dev screen
+: lcd-setup ( -- )
+ text-off
+
+ 0 h# 190 lcd!
+
+ h# 9000c h# 104 lcd!
+
+ \ Set the pitch to 6 bytes
+ 6 h# fc lcd!
+
+ \ Graphics in 4bpp mode
+ h# 8009.1100 h# 190 lcd!
+
+ \ Set the no-display-source background color to white
+\ h# ffffffff h# 124 lcd!
+;
+[then]
+
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2011 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/resetvec.bth
==============================================================================
--- cpu/arm/olpc/resetvec.bth Tue Jul 19 14:48:52 2011 (r2391)
+++ cpu/arm/olpc/resetvec.bth Tue Jul 19 15:08:06 2011 (r2392)
@@ -44,6 +44,8 @@
0 , \ To be patched later
end-code
+fload ${BP}/cpu/arm/olpc/numdot.fth
+
\ This subroutine is used by the startup code.
\ It compares two null-terminated strings, returning zero if they match.
\ Destroys: r2, r3
@@ -145,6 +147,9 @@
mov pc,r0 \ Execute the dropin
[then]
+ mov r0,#0x10
+ bl `puthex`
+
\ Setup the page (section) table and turn on the MMU and caches
\ set r0,`page-table-pa #`
set r0,`fw-pa page-table-offset + #`
@@ -152,6 +157,9 @@
bl `enable-mmu` \ Turn on the MMU
bl `caches-on` \ Turn on the caches
+ mov r0,#0x11
+ bl `puthex`
+
\ Now we are running with the MMU and caches on, thus going faster
\ Locate the dropin module named "firmware".
@@ -165,12 +173,17 @@
\ and use it to inflate the firmware into RAM
mov r11,r0 \ Save address of firmware dropin
+ mov r0,#0x12
+ bl `puthex`
\ Locate the "inflate" module.
" inflate" $find-dropin, \ Assemble call to find-dropin with literal arg
add r4,r0,#32 \ r1: Base address of inflater code
+ mov r0,#0x13
+ bl `puthex`
+
\ Execute the inflater, giving it the address of the compressed firmware
\ module, the address where the inflated firmware should be placed, and
\ the address of some RAM the inflater can use for scratch variables.
@@ -199,7 +212,12 @@
else
\ The firmware dropin isn't compressed, so we just copy it to RAM
- ldr r2,[r0,#4] \ Length of image
+ mov r11,r0
+
+ mov r0,#0x14
+ bl `puthex`
+
+ ldr r2,[r11,#4] \ Length of image
eor r1,r2,r2, ror #16 \ Byte reverse r2 using the
bic r1,r1,#0xff0000 \ tricky sequence shown in the
@@ -212,10 +230,16 @@
bl `memcpy` \ Copy the firmware
then
+ mov r0,#0x15
+ bl `puthex`
+
\ Synchronize the instruction and data caches so the firmware code can
\ be executed.
bl `sync-caches` \ Push Forth dictionary to memory
+ mov r0,#0x16
+ bl `puthex`
+
[ifdef] notdef
" nanoforth" $find-dropin, \ Assemble call to find-dropin with literal arg