Add a lock around the ttyprint function.

The ttyprint function is responsible for outputing text to the serial console
in a particular location. If two CPUs interrupt each other with serial output,
the escape sequences they use to move around the screen interleave and are
actually printed, and the cursor isn't moved.

This change adds a lock around the contents of ttyprint so that there won't be
any overlap. There is still no lock around serial_echo_init which is actually
used to write to the serial port. This is only called in one other place when
the BSP is initializing the display the first time around, so as used currently
there doesn't need to be a lock. Theoretically though, that code could be
called in other contexts and could exhibit this same problem. Because the
problem is only theoretical for now and fixing it would add otherwise
unnecessary overhead, I've left that out.

BUG=chromium-os:26458
TEST=Ran on Stumpy with SMP reenabled and saw serial artifacts go away.

Change-Id: I07d8fe3184291439ee7aa1bf1cf08a60b913d550
Signed-off-by: Gabe Black <gabeblack@google.com>
1 file changed