aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2016-11-24 15:08:19 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-11-24 16:47:16 +1100
commita5761fb4585520983716d17fdb33f04891cf0479 (patch)
treee39a4db8f7b9f58817019596ef35a26e5d9461ed /include
parent9c471e0e6eafca3b0f249b649e5cf8ac752bffd1 (diff)
downloadskiboot-a5761fb4585520983716d17fdb33f04891cf0479.zip
skiboot-a5761fb4585520983716d17fdb33f04891cf0479.tar.gz
skiboot-a5761fb4585520983716d17fdb33f04891cf0479.tar.bz2
slw: do SLW timer testing while holding xscom lock
We add some routines that let a caller get the xscom lock once and then do a bunch of xscoms while holding it. In some situations without this, it could take long enough to get the xscom lock that the 1ms timeout would expire and we'd falsely think the SLW timer didn't work when in fact it did. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/xscom.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/xscom.h b/include/xscom.h
index f955021..bad9140 100644
--- a/include/xscom.h
+++ b/include/xscom.h
@@ -208,9 +208,22 @@
* Error codes TBD, 0 = success
*/
+/* Use only in select places where multiple SCOMs are time/latency sensitive */
+extern void _xscom_lock(void);
+extern int _xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val, bool take_lock);
+extern int _xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val, bool take_lock);
+extern void _xscom_unlock(void);
+
+
/* Targeted SCOM access */
-extern int xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val);
-extern int xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val);
+static inline int xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val)
+{
+ return _xscom_read(partid, pcb_addr, val, true);
+}
+static inline int xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val) {
+ return _xscom_write(partid, pcb_addr, val, true);
+}
+
/* This chip SCOM access */
extern int xscom_readme(uint64_t pcb_addr, uint64_t *val);