From a5761fb4585520983716d17fdb33f04891cf0479 Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Thu, 24 Nov 2016 15:08:19 +1100 Subject: 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 --- include/xscom.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'include') 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); -- cgit v1.1