Author: quozl Date: Mon Feb 4 08:50:34 2013 New Revision: 3533 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3533
Log: OLPC - allocate any heap during driver open rather than during an alarm handler, for the /ap-sp, /keyboard, and /usb/keyboard drivers, fixes #12466, tested with 128,000 boot cycles across four units.
Modified: cpu/arm/olpc/spcmd.fth dev/pckbd.fth dev/usb2/device/keyboard/kbd.fth
Modified: cpu/arm/olpc/spcmd.fth ============================================================================== --- cpu/arm/olpc/spcmd.fth Mon Feb 4 08:47:38 2013 (r3532) +++ cpu/arm/olpc/spcmd.fth Mon Feb 4 08:50:34 2013 (r3533) @@ -49,21 +49,21 @@ #queues /n* buffer: heads : head ( -- adr ) heads queue# na+ ; #queues /n* buffer: tails : tail ( -- adr ) tails queue# na+ ;
-#queues /q * buffer: qs : q ( adr -- ) qs queue# /q * + ; +#queues /q * buffer: qs : q ( -- adr ) qs queue# /q * + ;
/q 1- value q-end
: init-queues ( -- ) #queues 0 do i to queue# - 0 head ! 0 tail ! /q 1- to q-end + 0 head ! 0 tail ! q drop /q 1- to q-end loop ; : inc-q-ptr ( pointer-addr -- ) dup @ q-end >= if 0 swap ! else /c swap +! then ;
-false value locked? \ Interrupt lockout for get-scan +false value locked? \ Interrupt lockout for get-data?
: lock ( -- ) true to locked? ; : unlock ( -- ) false to locked? ; @@ -125,6 +125,7 @@ 0 value open-count : open ( -- flag ) open-count 0= if + init-queues my-address my-space h# 1000 " map-in" $call-parent is reg-base data? 0= if send-rdy then then
Modified: dev/pckbd.fth ============================================================================== --- dev/pckbd.fth Mon Feb 4 08:47:38 2013 (r3532) +++ dev/pckbd.fth Mon Feb 4 08:50:34 2013 (r3533) @@ -55,7 +55,7 @@ /q dup buffer: q 1- value q-end
-: init-q ( -- ) 0 head ! 0 tail ! /q 1- to q-end ; +: init-q ( -- ) 0 head ! 0 tail ! q drop /q 1- to q-end ; : inc-q-ptr ( pointer-addr -- ) dup @ q-end >= if 0 swap ! else /c swap +! then ;
Modified: dev/usb2/device/keyboard/kbd.fth ============================================================================== --- dev/usb2/device/keyboard/kbd.fth Mon Feb 4 08:47:38 2013 (r3532) +++ dev/usb2/device/keyboard/kbd.fth Mon Feb 4 08:50:34 2013 (r3533) @@ -67,7 +67,10 @@ \ examined by getkey (to application) /qe buffer: null-entry \ Buffer to hold a null entry
-: init-q ( -- ) 0 head ! 0 tail ! #qe 1- to q-end ; +: init-q ( -- ) + 0 head ! 0 tail ! q drop #qe 1- to q-end + last-entry drop new-entry drop cur-entry drop null-entry drop +; : inc-q-ptr ( pointer-addr -- ) dup @ q-end >= if 0 swap ! else 1 swap +! then ; @@ -370,6 +373,7 @@
: open ( -- flag ) kbd-refcount @ if 1 +refcnt true exit then + init-q init-kbd-buf setup-hardware? if free-kbd-buf
openfirmware@openfirmware.info