Author: wmb Date: Tue Nov 23 23:34:45 2010 New Revision: 2033 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2033
Log: OLPC XO-1.75 - Fixed race condition in EC SPI module.
Modified: dev/olpc/kb3700/spicmd.fth
Modified: dev/olpc/kb3700/spicmd.fth ============================================================================== --- dev/olpc/kb3700/spicmd.fth Tue Nov 23 00:42:23 2010 (r2032) +++ dev/olpc/kb3700/spicmd.fth Tue Nov 23 23:34:45 2010 (r2033) @@ -241,6 +241,7 @@ pulse-ack ; : (upstream) ( -- ) + rxavail 2 <> if ." ec-spi rxavail = " rxavail . cr debug-me then ssp-ssdr rl@ ssp-ssdr rl@ ( channel# data ) debug? if ." UP: " over . dup . cr @@ -265,7 +266,9 @@ ;
: poll ( -- ) + lock[ ssp-ready? if do-state then + ]unlock debug? if key? if key drop debug-me then then ; : cancel-command ( -- ) \ Called when the command child times out @@ -354,10 +357,20 @@ dup 5 > abort" Too many EC command arguments" ec-cmdbuf 3 + swap bounds ?do i c! loop ( ) ; +: timed-get-data ( -- b ) + get-msecs d# 20 + begin ( limit ) + " get-data?" $call-parent if ( limit data ) + nip exit + then ( limit ) + dup get-msecs - 0< ( limit ) + until ( limit ) + drop + true abort" EC command result timeout" +; + : get-results ( -- [ results ] ) ec-respbuf #results bounds ?do - begin " get-data?" $call-parent until ( byte ) - i c! + timed-get-data i c! loop
#results 0 ?do \ XXX maybe this loop should go backwards?
openfirmware@openfirmware.info