[NEUS7920-477] [9610] wlbt: Minimoredump collected in sbl file
authorAlbert Cano <a.canocamps@samsung.com>
Fri, 15 Feb 2019 15:05:06 +0000 (15:05 +0000)
committerKim Gunho <gunho.kim@samsung.com>
Fri, 28 Jun 2019 14:46:02 +0000 (23:46 +0900)
Minimoredump collected in sbl file

SCSC-Bug-Id: SSB-49072
Change-Id: If93dfa1332e75e0f41541f205e1494ade728c168
Signed-off-by: Albert Cano <a.canocamps@samsung.com>
Signed-off-by: Purnendu Kapadia <p.kapadia@samsung.com>
drivers/misc/samsung/scsc/mxman.c
drivers/misc/samsung/scsc/scsc_log_collector.c
include/scsc/scsc_log_collector.h

index 581cd626bf74898a408e72db2006faac754fe7ea..b58197828ae1cc6888ba7202b8e2fbd1fb2a3dba 100755 (executable)
@@ -184,6 +184,35 @@ static ssize_t sysfs_store_memdump(struct kobject *kobj, struct kobj_attribute *
 static struct kobj_attribute memdump_attr =
                __ATTR(memdump, 0660, sysfs_show_memdump, sysfs_store_memdump);
 
+
+#ifdef CONFIG_SCSC_LOG_COLLECTION
+static int mxman_minimoredump_collect(struct scsc_log_collector_client *collect_client, size_t size)
+{
+       int ret = 0;
+       struct mxman *mxman = (struct mxman *) collect_client->prv;
+
+       if (!mxman || !mxman->start_dram)
+               return ret;
+
+       SCSC_TAG_INFO(MXMAN, "Collecting Minimoredump runtime_length %d fw_image_size %d\n",
+               mxman->fwhdr.fw_runtime_length, mxman->fw_image_size);
+       /* collect RAM sections of FW */
+       ret = scsc_log_collector_write(mxman->start_dram + mxman->fw_image_size,
+               mxman->fwhdr.fw_runtime_length - mxman->fw_image_size, 1);
+
+       return ret;
+}
+
+struct scsc_log_collector_client mini_moredump_client = {
+       .name = "minimoredump",
+       .type = SCSC_LOG_MINIMOREDUMP,
+       .collect_init = NULL,
+       .collect = mxman_minimoredump_collect,
+       .collect_end = NULL,
+       .prv = NULL,
+};
+#endif
+
 /* Retrieve memdump in sysfs global */
 static ssize_t sysfs_show_memdump(struct kobject *kobj,
                                  struct kobj_attribute *attr,
@@ -1113,6 +1142,12 @@ static int mxman_start(struct mxman *mxman)
        mxlog_init(scsc_mx_get_mxlog(mxman->mx), mxman->mx, mxman->fw_build_id);
 #ifdef CONFIG_SCSC_MXLOGGER
        mxlogger_init(mxman->mx, scsc_mx_get_mxlogger(mxman->mx), MXL_POOL_SZ);
+
+#ifdef CONFIG_SCSC_LOG_COLLECTION
+       /* Register minimoredump  client */
+       mini_moredump_client.prv = mxman;
+       scsc_log_collector_register_client(&mini_moredump_client);
+#endif
 #endif
 #ifdef CONFIG_SCSC_SMAPPER
        /* Initialize SMAPPER */
@@ -1912,6 +1947,10 @@ void mxman_close(struct mxman *mxman)
                        return;
                }
 #ifdef CONFIG_SCSC_MXLOGGER
+#ifdef CONFIG_SCSC_LOG_COLLECTION
+               /* Unregister minimoredump client */
+               scsc_log_collector_unregister_client(&mini_moredump_client);
+#endif
                /**
                 * Deinit mxlogger on last service stop...BUT before asking for HALT
                 */
@@ -1939,6 +1978,10 @@ void mxman_close(struct mxman *mxman)
                        return;
                }
 #ifdef CONFIG_SCSC_MXLOGGER
+#ifdef CONFIG_SCSC_LOG_COLLECTION
+               /* Unregister minimoredump client */
+               scsc_log_collector_unregister_client(&mini_moredump_client);
+#endif
                /**
                 * Deinit mxlogger on last service stop...BUT before asking for HALT
                 */
index 3e895c049c19bc555e0b43e795d543d0f6c2b98e..b45dffc9244899d7ea39abc00a2a5057a6bbe586 100644 (file)
@@ -25,7 +25,7 @@
 #include "scsc_wlbtd.h"
 #endif
 
-#define SCSC_NUM_CHUNKS_SUPPORTED      12
+#define SCSC_NUM_CHUNKS_SUPPORTED      13
 
 #define TO_RAM                         0
 #define TO_FILE                                1
@@ -42,6 +42,7 @@ static u8 chunk_supported_sbl[SCSC_NUM_CHUNKS_SUPPORTED] = {
        SCSC_LOG_RESERVED_BT,
        SCSC_LOG_RESERVED_WLAN,
        SCSC_LOG_RESERVED_RADIO,
+       SCSC_LOG_MINIMOREDUMP,
        SCSC_LOG_CHUNK_LOGRING,
 };
 
index 30983bcb4c2717d0b8ba04573d6f9a31bcb89fa3..25167032e1c9de76191777218394f71b445da758 100644 (file)
@@ -8,8 +8,8 @@
 #define __SCSC_LOG_COLLECTOR_H__
 
 /* High nibble is Major, Low nibble is Minor */
-#define SCSC_LOG_HEADER_VERSION_MAJOR  0x02
-#define SCSC_LOG_HEADER_VERSION_MINOR  0x01
+#define SCSC_LOG_HEADER_VERSION_MAJOR  0x03
+#define SCSC_LOG_HEADER_VERSION_MINOR  0x00
 /* Magic string. 4 bytes "SCSC"*/
 /* Header version. 1 byte */
 /* Num chunks. 1 byte */
@@ -57,7 +57,9 @@ extern const char *scsc_loc_reason_str[];
  */
 enum scsc_log_chunk_type {
        SCSC_LOG_CHUNK_SYNC, /* SYNC should be the first chunk to collect */
-       SCSC_LOG_CHUNK_IMP,
+       SCSC_LOG_MINIMOREDUMP,
+       /* Add other chunks */
+       SCSC_LOG_CHUNK_IMP = 127,
        SCSC_LOG_CHUNK_MXL,
        SCSC_LOG_CHUNK_UDI,
        SCSC_LOG_CHUNK_BT_HCF,
@@ -67,8 +69,8 @@ enum scsc_log_chunk_type {
        SCSC_LOG_RESERVED_BT,
        SCSC_LOG_RESERVED_WLAN,
        SCSC_LOG_RESERVED_RADIO,
-       SCSC_LOG_CHUNK_LOGRING = 254,
        /* Add other chunks */
+       SCSC_LOG_CHUNK_LOGRING = 254,
        SCSC_LOG_CHUNK_INVALID = 255,
 };