summaryrefslogtreecommitdiffstats
path: root/hw/lpc-uart.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2015-04-29 15:01:52 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-05-01 15:38:28 +1000
commita653df93b2d22691ac1583584c8292e6e421464f (patch)
tree1b9927b726e5f7eff67a47855e09cb7de7d3bed0 /hw/lpc-uart.c
parent96ed5814761ca57ff2338d4501c4e40bf213f8e2 (diff)
downloadblackbird-skiboot-a653df93b2d22691ac1583584c8292e6e421464f.tar.gz
blackbird-skiboot-a653df93b2d22691ac1583584c8292e6e421464f.zip
Add xscom_ok() and lpc_ok() to check XSCOM and LPC usability
his primarily checks whether the caller already holds the corresponding locks to avoid re-entrancy in some of the deep error path such as when XSCOM itself triggers an error log. It will be extended in the case of LPC to also handle known HW error states. We use them to avoid queuing/polling in the BT driver and to discard characters in the UART driver. Note: This will not normally involve a loss of log to the UART as the UART driver is also protected by the console suspend mechanism. So this is a safety mechanism only. This fixes issues where the generation of error logs inside the LPC or XSCOM drivers could cause a re-entrancy (via the BT interface) causing deadlocks. Now, the error logs IPMI messages will be queued up and delivered later on the next poll handler. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/lpc-uart.c')
-rw-r--r--hw/lpc-uart.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/lpc-uart.c b/hw/lpc-uart.c
index 2e6114ac..7c3190e3 100644
--- a/hw/lpc-uart.c
+++ b/hw/lpc-uart.c
@@ -135,6 +135,10 @@ static size_t uart_con_write(const char *buf, size_t len)
{
size_t written = 0;
+ /* If LPC bus is bad, we just swallow data */
+ if (!lpc_ok())
+ return written;
+
lock(&uart_lock);
while(written < len) {
if (tx_room == 0) {
OpenPOWER on IntegriCloud