[openfirmware] r1296 - cpu/x86/pc/olpc cpu/x86/pc/olpc/via dev/olpc/kb3700 ofw/wifi

svn at openfirmware.info svn at openfirmware.info
Thu Aug 13 06:44:59 CEST 2009


Author: wmb
Date: 2009-08-13 06:44:59 +0200 (Thu, 13 Aug 2009)
New Revision: 1296

Modified:
   cpu/x86/pc/olpc/crypto.fth
   cpu/x86/pc/olpc/fsupdate.fth
   cpu/x86/pc/olpc/security.fth
   cpu/x86/pc/olpc/via/acpi.fth
   cpu/x86/pc/olpc/via/copynand.fth
   cpu/x86/pc/olpc/via/fsupdate.fth
   cpu/x86/pc/olpc/via/suspend.fth
   dev/olpc/kb3700/battery.fth
   ofw/wifi/eapol.fth
Log:
OLPC - fixed a bunch of name collisions to reduce the number
of "isn't unique" messages.



Modified: cpu/x86/pc/olpc/crypto.fth
===================================================================
--- cpu/x86/pc/olpc/crypto.fth	2009-08-12 06:42:55 UTC (rev 1295)
+++ cpu/x86/pc/olpc/crypto.fth	2009-08-13 04:44:59 UTC (rev 1296)
@@ -32,7 +32,7 @@
 
 variable hashlen
 d# 128 buffer: hashbuf
-: hash  ( data$ hashname$ -- result$ )
+: crypto-hash  ( data$ hashname$ -- result$ )
    2>r  hashbuf d# 128  hashlen 0  2r>   ( data$ sig$ key$ hashname$ )
    signature-bad?  abort" Hash failed"   ( )
    hashbuf hashlen @

Modified: cpu/x86/pc/olpc/fsupdate.fth
===================================================================
--- cpu/x86/pc/olpc/fsupdate.fth	2009-08-12 06:42:55 UTC (rev 1295)
+++ cpu/x86/pc/olpc/fsupdate.fth	2009-08-13 04:44:59 UTC (rev 1296)
@@ -91,7 +91,7 @@
    get-hex#                                    ( eblock# )
    read-image-block
    load-base /nand-block    safe-parse-word    ( eblock# data$ hashname$ )
-   hash                                        ( eblock# result$ )
+   crypto-hash                                 ( eblock# result$ )
    safe-parse-word hex-decode  " Malformed hash string" ?nand-abort
    $=  if                                      ( eblock# )
       drop 

Modified: cpu/x86/pc/olpc/security.fth
===================================================================
--- cpu/x86/pc/olpc/security.fth	2009-08-12 06:42:55 UTC (rev 1295)
+++ cpu/x86/pc/olpc/security.fth	2009-08-13 04:44:59 UTC (rev 1296)
@@ -20,8 +20,6 @@
    debug-security?  if  red-letters type black-letters cr  else  2drop  then
 ;
 
-code halt  hlt  c;  \ To save power
-
 : fail-load  ( -- )
    show-sad
    text-on
@@ -256,12 +254,12 @@
 \ hashname remembers the most recently used hashname to guard against
 \ attacks based on reuse of the same (presumably compromized) hash.
 
-\ invalid? checks the validity of data$ against the ASCII signature
+\ signature-invalid? checks the validity of data$ against the ASCII signature
 \ record sig01$, using the public key that thiskey$ points to.
 \ It also verifies that the hashname contained in sig01$ is the
 \ expected one.
 
-: invalid?  ( data$ sig01$ exp-hashname$ -- error? )
+: signature-invalid?  ( data$ sig01$ exp-hashname$ -- error? )
    2>r
    parse-sig  if
       ." Bad signature format"  cr
@@ -355,7 +353,7 @@
 \ Find a sig01: line and check its sha256/rsa signature
 : sha-valid?  ( data$ sig01$ -- okay? )
    next-sig01-in-list$  if  2drop false exit  then  ( data$ rem$ sig01$ )
-   2nip  " sha256" invalid? 0=
+   2nip  " sha256" signature-invalid? 0=
 ;
 
 \ Find two sig01: lines, the first with sha256 and the second with rmd160,
@@ -367,7 +365,7 @@
       2r> 4drop false exit
    then                                         ( rmd-sig$ r: data$ )
    next-sig01$  if  2r> 2drop false exit  then  ( rem$ sig01$ )
-   2nip  2r> 2swap " rmd160" invalid? 0=
+   2nip  2r> 2swap " rmd160" signature-invalid? 0=
 ;
 
 \ numfield is a factor used for parsing 2-digit fields from date/time strings.
@@ -503,13 +501,13 @@
 \ doesn't match our pubkey.
 
 : check-machine-signature  ( sig$ expiration$ -- -1|1 )
-   2over  in-pubkey-list?   if                          ( sig$ exp$ )
-      machine-id-buf d# 51 +  swap  move                ( sig$ )
-      machine-id-buf d# 67  2swap                       ( id$ sig$ )
-      " sha256" invalid?  if  -1  else  1  then         ( -1|1 )
-   else                                                 ( sig$ exp$ )
-      4drop 0                                           ( 0 )
-   then                                                 ( -1|0|1 )
+   2over  in-pubkey-list?   if                            ( sig$ exp$ )
+      machine-id-buf d# 51 +  swap  move                  ( sig$ )
+      machine-id-buf d# 67  2swap                         ( id$ sig$ )
+      " sha256" signature-invalid?  if  -1  else  1  then ( -1|1 )
+   else                                                   ( sig$ exp$ )
+      4drop 0                                             ( 0 )
+   then                                                   ( -1|0|1 )
 ;
 
 : set-disposition  ( adr -- )  c@  machine-id-buf d# 49 + c!  ;

Modified: cpu/x86/pc/olpc/via/acpi.fth
===================================================================
--- cpu/x86/pc/olpc/via/acpi.fth	2009-08-12 06:42:55 UTC (rev 1295)
+++ cpu/x86/pc/olpc/via/acpi.fth	2009-08-13 04:44:59 UTC (rev 1296)
@@ -212,7 +212,7 @@
    negate h# ff and  r> r> + c!
 ;
 
-: memory-limit  ( -- limit )
+: acpi-memory-limit  ( -- limit )
    " /memory" find-package 0= abort" No /memory node"  ( phandle )
    " available" rot get-package-property abort" No available property"  ( $ )
    -1 >r                              ( $ )  ( r: limit )
@@ -270,7 +270,7 @@
 [ifdef] notdef
    \ This has to agree with the _SB's _INI method, which gets the memory size
    \ from offset h# 180 in the EBDA
-   memory-limit d# 10 rshift  'ebda h# 180 + l!
+   acpi-memory-limit d# 10 rshift  'ebda h# 180 + l!
 [then]
 
    \ Copy tables to low memory

Modified: cpu/x86/pc/olpc/via/copynand.fth
===================================================================
--- cpu/x86/pc/olpc/via/copynand.fth	2009-08-12 06:42:55 UTC (rev 1295)
+++ cpu/x86/pc/olpc/via/copynand.fth	2009-08-13 04:44:59 UTC (rev 1296)
@@ -197,7 +197,7 @@
 \ 6 - erased           : show-erased
 \ 7 - primary   bad-block-table  : show-bbt-block
 \ 8 - secondary bad-block-table  : show-bbt-block
-: show-status  ( status eblock# -- )
+: show-block-type  ( status eblock# -- )
    swap case
       0  of  show-bad        endof
       1  of  show-bad        endof
@@ -262,12 +262,12 @@
    3dup  0 1 xy+  1 grid-h do-fill            ( color x y )
    1 grid-h xy+  grid-w 1  do-fill
 ;
-: lowlight  ( block# -- )  background-rgb rgb>565 cell-border  ;
-: highlight  ( block# -- )  0 cell-border  ;
+: lowlight-block  ( block# -- )  background-rgb rgb>565 cell-border  ;
+: highlight-block  ( block# -- )  0 cell-border  ;
 : point-block  ( block# -- )
-   current-block lowlight
+   current-block lowlight-block
    to current-block
-   current-block highlight
+   current-block highlight-block
 ;
 
 0 value nand-block-limit
@@ -296,10 +296,10 @@
    0 status-line 1- at-xy  red-letters ." Arrows, fn Arrows to move, Esc to exit" black-letters cr
    #nand-pages nand-pages/block /  to nand-block-limit
    0 to current-block
-   current-block highlight
+   current-block highlight-block
    false to examine-done?
    begin key  process-key  examine-done? until
-   current-block lowlight
+   current-block lowlight-block
 ;
 
 : (scan-nand)  ( -- )
@@ -314,7 +314,7 @@
       i classify-block       ( status )
       i nand-pages/block /   ( status eblock# )
       2dup nand-map + c!     ( status eblock# )
-      show-status
+      show-block-type        ( )
    nand-pages/block +loop  ( )
 
    show-done
@@ -325,225 +325,8 @@
    examine-nand
 ;
 
-
-: >eblock#  ( page# -- eblock# )  nand-pages/block /  ;
-
-: copy-nand  ( "devspec" -- )
-   open-nand
-   get-img-filename
-   open-img
-
-   ['] noop to show-progress
-
-   #nand-pages >eblock#  dup  show-init  ( #eblocks )
-
-   show-erasing                                    ( )
-
-   #image-eblocks show-writing
-
-   #image-eblocks  0  ?do
-      read-image-block
-      i check-mem-hash
-      load-base " copy-block" $call-nand          ( page# error? )
-      " Error writing to NAND FLASH" ?nand-abort  ( page# )
-      >eblock# show-written             ( )
-   loop
-
-   show-done
-
-   close-nand-ihs
-;
-
-: verify-nand  ( "devspec" -- )
-   open-nand
-   get-img-filename
-   open-img
-   ['] noop to show-progress
-
-   ." Verifing " #image-eblocks . ." blocks" cr
-
-   #image-eblocks  0  ?do
-      (cr i .
-      read-image-block
-
-      i /nand-block um* " seek" $call-nand drop
-      load-base /nand-block " read" $call-nand                         ( len )
-      /nand-block <>  " Disk read error" ?nand-abort                   ( )
-
-      load-base  load-base /nand-block +  /nand-block  comp  if        ( )
-         cr  ." Miscompare in block starting at page# "                ( )
-         ?key-stop
-      then                                                             ( )
-   loop                                                                ( )
-   close-nand-ihs
-;
-
-: verify-img  ( "img-devspec" -- )
-   hex
-   open-nand  close-nand-ihs   \ To set sizes
-   get-img-filename
-   open-img
-
-   ['] noop to show-progress
-
-   ." Verifying " #image-eblocks . ." blocks" cr
-
-   #image-eblocks  0  ?do
-      (cr i .  
-      read-image-block
-      i check-mem-hash
-   loop
-   close-nand-ihs
-;
-
-: check-hash  ( adr len -- )
-   2drop  \ XXX
-;
-
-: verify-nand  ( "crc-devspec" -- )
-   hex
-   open-nand
-   safe-parse-word  open-img
-   ['] noop to show-progress
-
-   ." Verifying " #image-eblocks . ." blocks" cr
-
-   #image-eblocks  0  ?do
-      (cr i .
-
-      i /nand-block um* " seek" $call-nand drop
-      load-base /nand-block " read" $call-nand             ( len )
-      /nand-block <>  " Disk read failure" ?nand-abort     ( )
-
-      load-base /nand-block  check-hash  if                ( )
-         cr ." Hash mismatch at eblock " i . cr            ( )
-         ?key-stop
-      else                                                 ( actual-crc expected-crc )
-         2drop                                             ( )
-      then                                                 ( )
-   loop                                                    ( )
-   close-nand-ihs
-;
-
-: make-new-file  ( devspec$ -- fileih )
-   2dup ['] $delete  catch  if  2drop  then  ( name$ )
-   2dup ['] $create-file  catch  if          ( name$ x x )
-      2drop                                  ( name$ )
-      " Can't open a file.  Try using the raw disk?" confirm  if  ( name$ )
-         open-dev                            ( ih )
-      else                                   ( name$ )
-         2drop 0                             ( ih=0 )
-      then                                   ( ih )
-   else                                      ( name$ ih )
-      nip nip                                ( ih )
-   then                                      ( ih )
-;
-
-: open-dump-file  ( devspec$ -- )
-   cr ." Dumping to " 2dup type  cr
-
-   make-new-file  to fileih
-
-   fileih 0=  " Can't open output"  ?nand-abort
-;
-
-: dump-eblock?  ( block# -- flag )
-   \ Dump JFFS2 w/summary (2), JFFS2 w/o summary (3), non JFFS2 data (5)
-   nand-map + c@  dup 2 =  over 3 = or  swap 5 = or
-;
-
-0 [if]
-: eblock>file  ( -- )
-   load-base /nand-block  " write" fileih $call-method
-   /nand-block  <>  " Write to dump file failed" ?nand-abort
-   load-base /nand-block $crc #image-eblocks >crc l!
-   #image-eblocks 1+ to #image-eblocks
-;
-
-: fastdump-nand  ( -- )
-   \ The stack is empty at the end of each line unless otherwise noted
-   (scan-nand)
-
-   cursor-off
-   d# 20 status-line at-xy   ."          "
-
-   " usable-page-limit" $call-nand  >eblock#  0  do
-      i dump-eblock?  if
-         i point-block
-         i show-eblock#
-         load-base  i nand-pages/block *  nand-pages/block  " read-pages" $call-nand  ( #read )
-         nand-pages/block <>  " Read failed" ?nand-abort
-         eblock>file
-      then
-   loop
-   show-done
-;
-
-: slowdump-nand  ( -- )
-   \ The stack is empty at the end of each line unless otherwise noted
-   #nand-pages  0  ?do
-      (cr i >eblock# .
-      load-base  i  nand-pages/block  " read-pages" $call-nand  ( #read )
-      nand-pages/block =  if
-         load-base /nand-block  written?  if
-            ." w"
-            eblock>file
-            i  nand-pages/block  bounds  ?do
-               i pad !  pad 4 " write" fileih $call-method
-               4 <>  " Write of eblock number failed" ?nand-abort
-            loop
-         else
-            ." s"
-         then
-      then
-   nand-pages/block +loop
-;
-
-: (dump-nand)  ( "devspec" -- )
-   open-nand
-   get-img-filename
-
-   alloc-crc-buf
-   image-name$ open-dump-file
-
-   0 to #image-eblocks
-
-   fastdump-nand
-   cr  ." Done" cr
-
-   close-image-file
-
-   close-nand-ihs
-;
-: save-nand  ( "devspec" -- )  (dump-nand)  ;
-
-: fastcopy-nand  ( "devspec" -- )
-   open-nand
-
-   safe-parse-word  open-dev  to fileih
-   fileih 0= " Can't open NAND fastboot image file"  ?nand-abort
-
-   " size" fileih $call-method  drop                      ( len )
-   " start-fastcopy" $call-nand                           ( error? )
-   " Not enough spare NAND space for fast copy" ?nand-abort
-
-   begin                                                  ( )
-      load-base /nand-block  " read" fileih $call-method  ( len )
-   dup 0> while                                           ( len )
-      \ If the read didn't fill a complete block, zero the rest
-      load-base /nand-block  rot /string  erase
-
-      load-base " next-fastcopy" $call-nand               ( )
-   repeat                                                 ( len )
-   drop                                                   ( )
-   " end-fastcopy" $call-nand                             ( )
-
-   close-nand-ihs
-;
-[then]
-
 \ LICENSE_BEGIN
-\ Copyright (c) 2006 FirmWorks
+\ Copyright (c) 2009 FirmWorks
 \ 
 \ Permission is hereby granted, free of charge, to any person obtaining
 \ a copy of this software and associated documentation files (the

Modified: cpu/x86/pc/olpc/via/fsupdate.fth
===================================================================
--- cpu/x86/pc/olpc/via/fsupdate.fth	2009-08-12 06:42:55 UTC (rev 1295)
+++ cpu/x86/pc/olpc/via/fsupdate.fth	2009-08-13 04:44:59 UTC (rev 1296)
@@ -158,7 +158,7 @@
 : check-hash  ( -- )
    2>r                                ( eblock# hashname$ r: hash$ )
    data-buffer /nand-block 2swap      ( eblock# data$ hashname$ r: hash$ )
-   hash                               ( eblock# calc-hash$ r: hash$ )
+   crypto-hash                        ( eblock# calc-hash$ r: hash$ )
    2r>  $=  0=  if                    ( eblock# )
       ." Bad hash for eblock# " .x cr cr
       ." Your USB key may be bad.  Please try a different one." cr

Modified: cpu/x86/pc/olpc/via/suspend.fth
===================================================================
--- cpu/x86/pc/olpc/via/suspend.fth	2009-08-12 06:42:55 UTC (rev 1295)
+++ cpu/x86/pc/olpc/via/suspend.fth	2009-08-13 04:44:59 UTC (rev 1296)
@@ -41,13 +41,13 @@
       s3
    again   
 ;
-: suspend
+: s3-suspend
    " video-save" screen-ih $call-method  \ Freeze display
    s3
    " video-restore" screen-ih $call-method  \ Unfreeze display
 \   " /usb at f,5" open-dev  ?dup  if  " do-resume" 2 pick $call-method  close-dev  then
 ;
-alias s suspend
+alias s s3-suspend
 
 \ LICENSE_BEGIN
 \ Copyright (c) 2007 FirmWorks

Modified: dev/olpc/kb3700/battery.fth
===================================================================
--- dev/olpc/kb3700/battery.fth	2009-08-12 06:42:55 UTC (rev 1295)
+++ dev/olpc/kb3700/battery.fth	2009-08-13 04:44:59 UTC (rev 1296)
@@ -182,7 +182,7 @@
 0 value high
 0 value low
 false value 1w-initialized
-0 value fileih
+0 value bat-fileih
 
 : disable-ec-charging
    1 h# fa07 ec!
@@ -367,15 +367,15 @@
 : bat-save  ( -- )
    " disk:\battery.dmp"
    2dup ['] $delete  catch  if  2drop  then  ( name$ )
-   $create-file to fileih
+   $create-file to bat-fileih
 
    1w-init
    h# 80 0  do
       ds-bank$ i 1w-read
-      ds-bank$ " write" fileih $call-method
+      ds-bank$ " write" bat-fileih $call-method
    /ds-bank +loop
 
-   fileih close-dev
+   bat-fileih close-dev
 ;
 
 \ bg-* words access the gauge directly via 1w rather than

Modified: ofw/wifi/eapol.fth
===================================================================
--- ofw/wifi/eapol.fth	2009-08-12 06:42:55 UTC (rev 1295)
+++ ofw/wifi/eapol.fth	2009-08-13 04:44:59 UTC (rev 1296)
@@ -624,7 +624,7 @@
    endcase
 ;
 
-: set-bss-type  ( bss-type -- )  dup to bss-type  set-bss-type  ;
+: remember-bss-type  ( bss-type -- )  dup to bss-type  set-bss-type  ;
 
 : do-set-country-info  ( adr len -- )
    country-ie-len  if  2drop country-ie-buf country-ie-len  then  \ Override the country IE
@@ -699,7 +699,7 @@
    dup 8 + c@ rssi-ok? 0=  if  ." Signal too weak" cr drop false exit  then
    dup d# 19 + le-w@ 				\ Capabilities
    dup h# 10 and  if  kt-wep ktype!  then	\ Privacy
-   dup  3 and  set-bss-type			\ BSS type: managed/adhoc
+   dup  3 and  remember-bss-type		\ BSS type: managed/adhoc
    dup 20 and  if  2 set-preamble  then		\ Short preamble
    h# 433 and set-cap				\ Set our own capabilities
    dup 1 find-ie  if  add-common-rates  then	\ Supported rates




More information about the openfirmware mailing list