From c61d1c0e707a2c2e2426f07e4626cc9ca55043cd Mon Sep 17 00:00:00 2001 From: Albert Cano Date: Fri, 15 Feb 2019 15:05:06 +0000 Subject: [PATCH] [NEUS7920-477] [9610] wlbt: Minimoredump collected in sbl file Minimoredump collected in sbl file SCSC-Bug-Id: SSB-49072 Change-Id: If93dfa1332e75e0f41541f205e1494ade728c168 Signed-off-by: Albert Cano Signed-off-by: Purnendu Kapadia --- drivers/misc/samsung/scsc/mxman.c | 43 +++++++++++++++++++ .../misc/samsung/scsc/scsc_log_collector.c | 3 +- include/scsc/scsc_log_collector.h | 10 +++-- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/drivers/misc/samsung/scsc/mxman.c b/drivers/misc/samsung/scsc/mxman.c index 581cd626bf74..b58197828ae1 100755 --- a/drivers/misc/samsung/scsc/mxman.c +++ b/drivers/misc/samsung/scsc/mxman.c @@ -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 */ diff --git a/drivers/misc/samsung/scsc/scsc_log_collector.c b/drivers/misc/samsung/scsc/scsc_log_collector.c index 3e895c049c19..b45dffc92448 100644 --- a/drivers/misc/samsung/scsc/scsc_log_collector.c +++ b/drivers/misc/samsung/scsc/scsc_log_collector.c @@ -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, }; diff --git a/include/scsc/scsc_log_collector.h b/include/scsc/scsc_log_collector.h index 30983bcb4c27..25167032e1c9 100644 --- a/include/scsc/scsc_log_collector.h +++ b/include/scsc/scsc_log_collector.h @@ -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, }; -- 2.20.1