[openfirmware] [commit] r1999 - in cpu/arm: . olpc/1.75

repository service svn at openfirmware.info
Tue Nov 2 07:23:08 CET 2010


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  ;



More information about the openfirmware mailing list