QCA: Crashdump data to flash
If the dump_to_flash environment variable is set with the proper
offset in u-boot, crashdump data will be stored to flash memory.
Otherwise it will be stored in tftp server.
Change-Id: I10ac1016e3dfe6a2fa11a0a67c5774b29c3df67a
Signed-off-by: Gokul Sriram Palanisamy <gokulsri@codeaurora.org>
diff --git a/arch/arm/include/asm/arch-qca-common/qca_common.h b/arch/arm/include/asm/arch-qca-common/qca_common.h
index 68a8375..28529b9 100644
--- a/arch/arm/include/asm/arch-qca-common/qca_common.h
+++ b/arch/arm/include/asm/arch-qca-common/qca_common.h
@@ -51,6 +51,7 @@
void set_flash_secondary_type(qca_smem_flash_info_t *);
void dump_func(void);
+int do_dumpqca_flash_data(const char *);
int apps_iscrashed(void);
struct dumpinfo_t{
diff --git a/board/qca/arm/common/cmd_bootqca.c b/board/qca/arm/common/cmd_bootqca.c
index fe7a506..4fa5ad0 100644
--- a/board/qca/arm/common/cmd_bootqca.c
+++ b/board/qca/arm/common/cmd_bootqca.c
@@ -1343,8 +1343,7 @@
* the type of boot flash memory and writes all these crashdump information
* in provided offset in flash memory.
*/
-static int do_dumpqca_flash_data(cmd_tbl_t *cmdtp, int flag,
- int argc, char *const argv[])
+int do_dumpqca_flash_data(const char *offset)
{
unsigned char *kernel_crashdump_address =
(unsigned char *) CONFIG_QCA_KERNEL_CRASHDUMP_ADDRESS;
@@ -1353,8 +1352,6 @@
int ret_val;
loff_t crashdump_offset;
- if (argc != 2)
- return CMD_RET_USAGE;
if (sfi->flash_type == SMEM_BOOT_NAND_FLASH) {
flash_type = SMEM_BOOT_NAND_FLASH;
@@ -1369,7 +1366,7 @@
return CMD_RET_FAILURE;
}
- ret_val = str2off(argv[1], &crashdump_offset);
+ ret_val = str2off(offset, &crashdump_offset);
if (!ret_val)
return CMD_RET_USAGE;
@@ -1394,8 +1391,4 @@
return CMD_RET_SUCCESS;
}
-
-U_BOOT_CMD(dumpipq_flash_data, 2, 0, do_dumpqca_flash_data,
- "dumpipq_flash_data crashdump collection and storing in flash",
- "dumpipq_flash_data [offset in flash]\n");
#endif
diff --git a/common/autoboot.c b/common/autoboot.c
index 75fe0f3..751abe7 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -370,7 +370,11 @@
*/
if (apps_iscrashed()) {
printf("Crashdump magic found, initializing dump activity..\n");
- dump_func();
+ s = getenv("dump_to_flash");
+ if (s)
+ do_dumpqca_flash_data(s); /* write core dump data to flash */
+ else
+ dump_func();
return;
}
#endif