summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHsiu-Chang Chen <hsiuchangchen@google.com>2021-11-23 16:41:13 +0800
committerVictor Hsu <hsuvictor@google.com>2021-12-13 17:02:48 +0800
commitfb8529f751b6e63dfcac048e27b47e63d99d2476 (patch)
tree3e5a3ea6dc00328a0d5b9c1b1a7f73eb609d1a5d
parentaa8d11a216b3aa69ba637fc2118c50fb91cd09ab (diff)
downloadcnss2-fb8529f751b6e63dfcac048e27b47e63d99d2476.tar.gz
wcn6740: support coredump crash information
Bug: 205246511 Change-Id: I61551923f2b727646fb1cc061d9621ee1666cfa0
-rw-r--r--cnss2/pci.c8
-rw-r--r--cnss2/pci_platform_google.c32
-rw-r--r--inc/mhi_misc.h10
-rw-r--r--mhi/core/misc.c19
4 files changed, 66 insertions, 3 deletions
diff --git a/cnss2/pci.c b/cnss2/pci.c
index f84a86f..d59469b 100644
--- a/cnss2/pci.c
+++ b/cnss2/pci.c
@@ -547,6 +547,10 @@ static struct cnss_misc_reg syspm_reg_access_seq[] = {
#define WLAON_REG_SIZE ARRAY_SIZE(wlaon_reg_access_seq)
#define SYSPM_REG_SIZE ARRAY_SIZE(syspm_reg_access_seq)
+#if IS_ENABLED(CONFIG_WCN_GOOGLE)
+extern void crash_info_handler(u8 *info);
+#endif //CONFIG_WCN_GOOGLE
+
#if IS_ENABLED(CONFIG_MHI_BUS_MISC)
static void cnss_mhi_debug_reg_dump(struct cnss_pci_data *pci_priv)
{
@@ -555,7 +559,11 @@ static void cnss_mhi_debug_reg_dump(struct cnss_pci_data *pci_priv)
static void cnss_mhi_dump_sfr(struct cnss_pci_data *pci_priv)
{
+#if IS_ENABLED(CONFIG_WCN_GOOGLE)
+ mhi_dump_sfr(pci_priv->mhi_ctrl, crash_info_handler);
+#else
mhi_dump_sfr(pci_priv->mhi_ctrl);
+#endif //CONFIG_WCN_GOOGLE
}
static bool cnss_mhi_scan_rddm_cookie(struct cnss_pci_data *pci_priv,
diff --git a/cnss2/pci_platform_google.c b/cnss2/pci_platform_google.c
index 6446d3c..bcd2612 100644
--- a/cnss2/pci_platform_google.c
+++ b/cnss2/pci_platform_google.c
@@ -347,8 +347,31 @@ static void sscd_set_coredump(void *buf, int buf_len, const char *info)
memset(&seg, 0, sizeof(seg));
seg.addr = buf;
seg.size = buf_len;
- pdata->sscd_report(&sscd_dev, &seg, 1, 0, info);
+ if(info) {
+ pdata->sscd_report(&sscd_dev, &seg, 1, 0, info);
+ } else {
+ pdata->sscd_report(&sscd_dev, &seg, 1, 0, "Unknown");
+ }
+
+ }
+}
+
+u8 *crash_info = 0;
+void crash_info_handler(u8 *info)
+{
+ u32 string_len = 0;
+
+ if (crash_info) {
+ kfree(crash_info);
+ crash_info = 0;
}
+
+ string_len = strlen(info);
+ crash_info = kzalloc(string_len + 1, GFP_KERNEL);
+ if (!crash_info)
+ return;
+ strncpy(crash_info, info, string_len);
+ crash_info[string_len] = '\0';
}
int qcom_elf_dump(struct list_head *segs, struct device *dev)
@@ -428,7 +451,12 @@ int qcom_elf_dump(struct list_head *segs, struct device *dev)
/*
* SSCD integration
*/
- sscd_set_coredump(data, data_size, "Test Crash Info");
+ sscd_set_coredump(data, data_size, crash_info);
+ if (crash_info) {
+ kfree(crash_info);
+ crash_info = 0;
+ }
+
vfree(data);
return 0;
diff --git a/inc/mhi_misc.h b/inc/mhi_misc.h
index de3f585..75b25f1 100644
--- a/inc/mhi_misc.h
+++ b/inc/mhi_misc.h
@@ -99,7 +99,11 @@ void mhi_debug_reg_dump(struct mhi_controller *mhi_cntrl);
* mhi_dump_sfr - Print SFR string from RDDM table.
* @mhi_cntrl: MHI controller
*/
+#if IS_ENABLED(CONFIG_WCN_GOOGLE)
+void mhi_dump_sfr(struct mhi_controller *mhi_cntrl, void (*crash_info_handler)(u8*));
+#else
void mhi_dump_sfr(struct mhi_controller *mhi_cntrl);
+#endif //CONFIG_WCN_GOOGLE
/**
* mhi_device_configure - Allow devices with offload channels to setup their own
@@ -357,9 +361,15 @@ void mhi_debug_reg_dump(struct mhi_controller *mhi_cntrl)
* mhi_dump_sfr - Print SFR string from RDDM table.
* @mhi_cntrl: MHI controller
*/
+#if IS_ENABLED(CONFIG_WCN_GOOGLE)
+void mhi_dump_sfr(struct mhi_controller *mhi_cntrl, void (*crash_info_handler)(u8*))
+{
+}
+#else
void mhi_dump_sfr(struct mhi_controller *mhi_cntrl)
{
}
+#endif //CONFIG_WCN_GOOGLE
/**
* mhi_device_configure - Allow devices with offload channels to setup their own
diff --git a/mhi/core/misc.c b/mhi/core/misc.c
index 9c163eb..b002d57 100644
--- a/mhi/core/misc.c
+++ b/mhi/core/misc.c
@@ -613,8 +613,13 @@ error_suspend:
}
EXPORT_SYMBOL(mhi_pm_fast_suspend);
+#if IS_ENABLED(CONFIG_WCN_GOOGLE)
+static void mhi_process_sfr(struct mhi_controller *mhi_cntrl,
+ struct file_info *info, void (*crash_info_handler)(u8*))
+#else
static void mhi_process_sfr(struct mhi_controller *mhi_cntrl,
struct file_info *info)
+#endif //CONFIG_WCN_GOOGLE
{
struct mhi_buf *mhi_buf = mhi_cntrl->rddm_image->mhi_buf;
struct device *dev = &mhi_cntrl->mhi_dev->dev;
@@ -653,7 +658,11 @@ static void mhi_process_sfr(struct mhi_controller *mhi_cntrl,
}
}
sfr_buf[info->file_size] = '\0';
-
+#if IS_ENABLED(CONFIG_WCN_GOOGLE)
+ if (crash_info_handler) {
+ crash_info_handler(sfr_buf);
+ }
+#endif
/* force sfr string to log in kernel msg */
MHI_ERR("%s\n", sfr_buf);
err:
@@ -697,7 +706,11 @@ static int mhi_find_next_file_offset(struct mhi_controller *mhi_cntrl,
return 0;
}
+#if IS_ENABLED(CONFIG_WCN_GOOGLE)
+void mhi_dump_sfr(struct mhi_controller *mhi_cntrl, void (*crash_info_handler)(u8*))
+#else
void mhi_dump_sfr(struct mhi_controller *mhi_cntrl)
+#endif //CONFIG_WCN_GOOGLE
{
struct mhi_buf *mhi_buf = mhi_cntrl->rddm_image->mhi_buf;
struct rddm_header *rddm_header =
@@ -729,7 +742,11 @@ void mhi_dump_sfr(struct mhi_controller *mhi_cntrl)
if (!strcmp(table_info->file_name, "Q6-SFR.bin")) {
info.file_size = table_info->size;
+#if IS_ENABLED(CONFIG_WCN_GOOGLE)
+ mhi_process_sfr(mhi_cntrl, &info, crash_info_handler);
+#else
mhi_process_sfr(mhi_cntrl, &info);
+#endif //CONFIG_WCN_GOOGLE
return;
}