[ERD][NEUS7920-76] [COMMON] lib: dss: support connected logging for platform log
authorHosung Kim <hosung0.kim@samsung.com>
Mon, 22 Oct 2018 11:26:35 +0000 (20:26 +0900)
committerKim Gunho <gunho.kim@samsung.com>
Fri, 30 Aug 2019 07:58:56 +0000 (16:58 +0900)
Change-Id: I448813459c3b931ad969bc031085c7ab95b3c36e
Signed-off-by: Hosung Kim <hosung0.kim@samsung.com>
lib/debug-snapshot-log.h
lib/debug-snapshot.c

index 35fd4ac76ea76cad29e9c5f9736ab496bd4102cf..64e066662d411c7f30ec515b942543759c34f796 100644 (file)
@@ -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)
index 1cdf89c5a1a5a0225a76c9fe2776e5ded10cdf40..9027ae5a32b1334e77089e013b2fee5601996f2f 100644 (file)
@@ -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)