diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2015-04-29 15:01:52 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-05-01 15:38:28 +1000 |
commit | a653df93b2d22691ac1583584c8292e6e421464f (patch) | |
tree | 1b9927b726e5f7eff67a47855e09cb7de7d3bed0 /include | |
parent | 96ed5814761ca57ff2338d4501c4e40bf213f8e2 (diff) | |
download | skiboot-a653df93b2d22691ac1583584c8292e6e421464f.zip skiboot-a653df93b2d22691ac1583584c8292e6e421464f.tar.gz skiboot-a653df93b2d22691ac1583584c8292e6e421464f.tar.bz2 |
Add xscom_ok() and lpc_ok() to check XSCOM and LPC usabilityskiboot-5.0.1
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 'include')
-rw-r--r-- | include/lpc.h | 6 | ||||
-rw-r--r-- | include/xscom.h | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/lpc.h b/include/lpc.h index 5611c54..a0990fd 100644 --- a/include/lpc.h +++ b/include/lpc.h @@ -27,6 +27,12 @@ extern void lpc_init(void); /* Check for a default bus */ extern bool lpc_present(void); +/* Return of LPC is currently usable. This can be false if the caller + * currently holds a lock that would make it unsafe, or the LPC bus + * is known to be in some error condition (TBI). + */ +extern bool lpc_ok(void); + /* Handle the interrupt from LPC source */ extern void __attrconst lpc_interrupt(uint32_t chip_id); diff --git a/include/xscom.h b/include/xscom.h index b1ecaf5..a841261 100644 --- a/include/xscom.h +++ b/include/xscom.h @@ -173,6 +173,11 @@ extern void xscom_init(void); /* Mark XSCOM lock as being in console path */ extern void xscom_used_by_console(void); +/* Returns true if XSCOM can be used. Typically this returns false if + * the current CPU holds the XSCOM lock (to avoid re-entrancy from error path). + */ +extern bool xscom_ok(void); + extern int64_t xscom_read_cfam_chipid(uint32_t partid, uint32_t *chip_id); #endif /* __XSCOM_H */ |