[ERD][NEUS7920-76] [COMMON]lib: dss: Add saving dss item information for bootloader
authorChangki Kim <changki.kim@samsung.com>
Wed, 24 Oct 2018 05:37:12 +0000 (14:37 +0900)
committerKim Gunho <gunho.kim@samsung.com>
Fri, 30 Aug 2019 07:58:56 +0000 (16:58 +0900)
Change-Id: Ie4094df9be7d1a8296dd108667a8d7e6e1e6fde0
Signed-off-by: Changki Kim <changki.kim@samsung.com>
include/linux/debug-snapshot.h
lib/debug-snapshot-local.h
lib/debug-snapshot-log.h
lib/debug-snapshot.c

index d4136b0003575c66dcba7b45335d43d07515cfaf..0ee303467fa773857aa41e44be105b81234b6193 100644 (file)
@@ -57,6 +57,9 @@ extern void dbg_snapshot_hook_hardlockup_exit(void);
 extern void dbg_snapshot_dump_sfr(void);
 extern int dbg_snapshot_hook_pmsg(char *buffer, size_t count);
 extern void dbg_snapshot_save_log(int cpu, unsigned long where);
+extern int dbg_snapshot_add_bl_item_info(const char *name,
+               unsigned int paddr, unsigned int size);
+
 #define dbg_snapshot_irq_var(v)   do {    v = cpu_clock(raw_smp_processor_id());  \
                                  } while(0)
 /* option */
@@ -242,6 +245,11 @@ static inline bool dbg_snapshot_dumper_one(void *v_dumper,
 {
        return false;
 }
+static int dbg_snapshot_add_bl_item_info(const char *name,
+                               unsigned int paddr, unsigned int size)
+{
+       return 0;
+}
 #endif /* CONFIG_DEBUG_SNAPSHOT */
 
 extern void dbg_snapshot_soc_helper_init(void);
index 4c9114db612b28c885dc249e9d2062f6998c49a7..47997baa1b8bed4fa79d79c077aa835947cfba00 100644 (file)
@@ -63,6 +63,19 @@ struct dbg_snapshot_item {
        struct vm_struct vm;
 };
 
+struct dbg_snapshot_bl {
+       unsigned int magic1;
+       unsigned int magic2;
+       unsigned int item_count;
+       unsigned int reserved;
+       struct {
+               char name[SZ_16];
+               unsigned int paddr;
+               unsigned int size;
+               unsigned int enabled;
+       } item[SZ_16];
+};
+
 struct dbg_snapshot_sfrdump {
        char *name;
        void __iomem *reg;
index 64e066662d411c7f30ec515b942543759c34f796..282276b41a593d7a43bc739e1baea9cb4f7f4e1c 100644 (file)
 #define DSS_OFFSET_CORE_POWER_STAT     (0x400)
 #define DSS_OFFSET_PANIC_STAT          (0x500)
 #define DSS_OFFSET_CORE_LAST_PC                (0x600)
-
 /* S5P_VA_SS_BASE + 0x700 -- 0x8FF is reserved */
 #define DSS_OFFSET_LINUX_BANNER                (0x700)
-
-#define DSS_OFFSET_KERNEL_LOG          (0x900)
-#define DSS_OFFSET_PLATFORM_LOG                (0x904)
-#define DSS_OFFSET_KERNEL_EVENT                (0x908)
+#define DSS_OFFSET_ITEM_INFO           (0x900)
 
 /* S5P_VA_SS_BASE + 0xC00 -- 0xFFF is reserved */
 #define DSS_OFFSET_PANIC_STRING                (0xC00)
index 9027ae5a32b1334e77089e013b2fee5601996f2f..201824b8581e50ca787479e77030b0eff8760e00 100644 (file)
@@ -57,6 +57,7 @@ const char *debug_level_val[] = {
        "mid",
 };
 
+struct dbg_snapshot_bl *dss_bl;
 struct dbg_snapshot_item dss_items[] = {
        {"header",              {0, 0, 0, false, false}, NULL ,NULL, 0, },
        {"log_kernel",          {0, 0, 0, false, false}, NULL ,NULL, 0, },
@@ -102,6 +103,20 @@ int dbg_snapshot_get_debug_level(void)
        return dss_desc.debug_level;
 }
 
+int dbg_snapshot_add_bl_item_info(const char *name, unsigned int paddr, unsigned int size)
+{
+       if (dss_bl->item_count >= SZ_16)
+               return -1;
+
+       memcpy(dss_bl->item[dss_bl->item_count].name, name, strlen(name) + 1);
+       dss_bl->item[dss_bl->item_count].paddr = paddr;
+       dss_bl->item[dss_bl->item_count].size = size;
+       dss_bl->item[dss_bl->item_count].enabled = 1;
+       dss_bl->item_count++;
+
+       return 0;
+}
+
 int dbg_snapshot_set_enable(const char *name, int en)
 {
        struct dbg_snapshot_item *item = NULL;
@@ -584,6 +599,19 @@ static void __init dbg_snapshot_fixmap_header(void)
 
        /*  initialize kernel event to 0 except only header */
        memset((size_t *)(vaddr + DSS_KEEP_HEADER_SZ), 0, size - DSS_KEEP_HEADER_SZ);
+
+       dss_bl = dbg_snapshot_get_base_vaddr() + DSS_OFFSET_ITEM_INFO;
+       memset(dss_bl, 0, sizeof(struct dbg_snapshot_bl));
+       dss_bl->magic1 = 0x01234567;
+       dss_bl->magic2 = 0x89ABCDEF;
+       dss_bl->item_count = ARRAY_SIZE(dss_items);
+       memcpy(dss_bl->item[dss_desc.header_num].name,
+                       dss_items[dss_desc.header_num].name,
+                       strlen(dss_items[dss_desc.header_num].name) + 1);
+       dss_bl->item[dss_desc.header_num].paddr = paddr;
+       dss_bl->item[dss_desc.header_num].size = size;
+       dss_bl->item[dss_desc.header_num].enabled =
+               dss_items[dss_desc.header_num].entry.enabled;
 }
 
 static void __init dbg_snapshot_fixmap(void)
@@ -596,6 +624,11 @@ static void __init dbg_snapshot_fixmap(void)
        dbg_snapshot_fixmap_header();
 
        for (i = 1; i < ARRAY_SIZE(dss_items); i++) {
+               memcpy(dss_bl->item[i].name,
+                               dss_items[i].name,
+                               strlen(dss_items[i].name) + 1);
+               dss_bl->item[i].enabled = dss_items[i].entry.enabled;
+
                if (!dss_items[i].entry.enabled)
                        continue;
 
@@ -639,6 +672,12 @@ static void __init dbg_snapshot_fixmap(void)
                dss_info.info_log[i - 1].head_ptr = (unsigned char *)dss_items[i].entry.vaddr;
                dss_info.info_log[i - 1].curr_ptr = NULL;
                dss_info.info_log[i - 1].entry.size = size;
+
+               memcpy(dss_bl->item[i].name,
+                               dss_items[i].name,
+                               strlen(dss_items[i].name) + 1);
+               dss_bl->item[i].paddr = paddr;
+               dss_bl->item[i].size = size;
        }
 
        dss_log = (struct dbg_snapshot_log *)(dss_items[dss_desc.kevents_num].entry.vaddr);
@@ -710,7 +749,6 @@ static int __init dbg_snapshot_init_dt(void)
 static int __init dbg_snapshot_init_value(void)
 {
        int val = dbg_snapshot_get_debug_level_reg();
-       struct dbg_snapshot_item *item;
 
        dbg_snapshot_set_debug_level(val);
 
@@ -724,18 +762,6 @@ static int __init dbg_snapshot_init_value(void)
        strncpy(dbg_snapshot_get_base_vaddr() + DSS_OFFSET_LINUX_BANNER,
                linux_banner, strlen(linux_banner));
 
-       item = &dss_items[dss_desc.log_kernel_num];
-       __raw_writel(item->entry.paddr,
-               dbg_snapshot_get_base_vaddr() + DSS_OFFSET_KERNEL_LOG);
-
-       item = &dss_items[dss_desc.log_platform_num];
-       __raw_writel(item->entry.paddr,
-               dbg_snapshot_get_base_vaddr() + DSS_OFFSET_PLATFORM_LOG);
-
-       item = &dss_items[dss_desc.kevents_num];
-       __raw_writel(item->entry.paddr,
-               dbg_snapshot_get_base_vaddr() + DSS_OFFSET_KERNEL_EVENT);
-
        return 0;
 }