aboutsummaryrefslogtreecommitdiff
path: root/hw/lpc-uart.c
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2018-04-09 13:49:54 +1000
committerStewart Smith <stewart@linux.ibm.com>2018-04-29 20:44:23 -0500
commit23dc884f8a0f0b52d3e9312b64b9b02fcd8453a1 (patch)
tree65ab3459ebf1aecefc49080c5be8f24369a40ba2 /hw/lpc-uart.c
parent693a204364b0c6d00ae6daa1721fd5c03a4de74e (diff)
downloadskiboot-23dc884f8a0f0b52d3e9312b64b9b02fcd8453a1.zip
skiboot-23dc884f8a0f0b52d3e9312b64b9b02fcd8453a1.tar.gz
skiboot-23dc884f8a0f0b52d3e9312b64b9b02fcd8453a1.tar.bz2
uart: fix uart_opal_flush to take console lock over uart_con_flush
Cc: Russell Currey <ruscur@russell.cc> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'hw/lpc-uart.c')
-rw-r--r--hw/lpc-uart.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hw/lpc-uart.c b/hw/lpc-uart.c
index 3224de9..74a86b1 100644
--- a/hw/lpc-uart.c
+++ b/hw/lpc-uart.c
@@ -218,7 +218,7 @@ static uint8_t *out_buf;
static uint32_t out_buf_prod;
static uint32_t out_buf_cons;
-/* Asynchronous flush */
+/* Asynchronous flush, uart_lock must be held */
static int64_t uart_con_flush(void)
{
bool tx_was_full = tx_full;
@@ -388,10 +388,16 @@ static int64_t uart_opal_read(int64_t term_number, int64_t *length,
static int64_t uart_opal_flush(int64_t term_number)
{
+ int64_t rc;
+
if (term_number != 0)
return OPAL_PARAMETER;
- return uart_con_flush();
+ lock(&uart_lock);
+ rc = uart_con_flush();
+ unlock(&uart_lock);
+
+ return rc;
}
static void __uart_do_poll(u8 trace_ctx)