From 18810e1ce45c1e938107113df3c3d3cc64c9403e Mon Sep 17 00:00:00 2001 From: Hosung Kim Date: Mon, 22 Oct 2018 20:26:35 +0900 Subject: [PATCH] [ERD][NEUS7920-76] [COMMON] lib: dss: support connected logging for platform log Change-Id: I448813459c3b931ad969bc031085c7ab95b3c36e Signed-off-by: Hosung Kim --- lib/debug-snapshot-log.h | 1 + lib/debug-snapshot.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/debug-snapshot-log.h b/lib/debug-snapshot-log.h index 35fd4ac76ea7..64e066662d41 100644 --- a/lib/debug-snapshot-log.h +++ b/lib/debug-snapshot-log.h @@ -66,6 +66,7 @@ #define DSS_OFFSET_SCRATCH (0x100) #define DSS_OFFSET_DEBUG_LEVEL (0x180) #define DSS_OFFSET_LAST_LOGBUF (0x200) +#define DSS_OFFSET_LAST_PLATFORM_LOGBUF (0x280) #define DSS_OFFSET_EMERGENCY_REASON (0x300) #define DSS_OFFSET_CORE_POWER_STAT (0x400) #define DSS_OFFSET_PANIC_STAT (0x500) diff --git a/lib/debug-snapshot.c b/lib/debug-snapshot.c index 1cdf89c5a1a5..9027ae5a32b1 100644 --- a/lib/debug-snapshot.c +++ b/lib/debug-snapshot.c @@ -197,10 +197,18 @@ static inline void dbg_snapshot_hook_logger(const char *name, struct dbg_snapshot_item *item = &dss_items[dss_desc.log_platform_num]; if (likely(dss_base.enabled && item->entry.enabled)) { + size_t last_buf; + if (unlikely((dbg_snapshot_check_eob(item, size)))) item->curr_ptr = item->head_ptr; + memcpy(item->curr_ptr, buf, size); item->curr_ptr += size; + /* save the address of last_buf to physical address */ + last_buf = (size_t)item->curr_ptr; + + __raw_writel(item->entry.paddr + (last_buf - item->entry.vaddr), + dbg_snapshot_get_base_vaddr() + DSS_OFFSET_LAST_PLATFORM_LOGBUF); } } @@ -612,6 +620,16 @@ static void __init dbg_snapshot_fixmap(void) /* initialize logbuf to 0 */ memset((size_t *)vaddr, 0, size); } + } else if (i == dss_desc.log_platform_num) { + last_buf = (size_t)__raw_readl(dbg_snapshot_get_base_vaddr() + + DSS_OFFSET_LAST_PLATFORM_LOGBUF); + if (last_buf >= dss_items[i].entry.vaddr && + (last_buf) <= (dss_items[i].entry.vaddr + dss_items[i].entry.size)) { + dss_items[i].curr_ptr = (unsigned char *)(last_buf); + } else { + dss_items[i].curr_ptr = (unsigned char *)vaddr; + memset((size_t *)vaddr, 0, size); + } } else { /* initialized log to 0 if persist == false */ if (!dss_items[i].entry.persist) -- 2.20.1