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>
This commit is contained in:
Gokul Sriram Palanisamy 2018-01-29 13:18:16 +05:30
parent 68e5a86eb8
commit ebfe553da8
3 changed files with 8 additions and 10 deletions

View file

@ -51,6 +51,7 @@ void board_mmc_deinit(void);
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{

View file

@ -1343,8 +1343,7 @@ static int qca_wdt_write_crashdump_data(
* 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 @@ static int do_dumpqca_flash_data(cmd_tbl_t *cmdtp, int flag,
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 @@ static int do_dumpqca_flash_data(cmd_tbl_t *cmdtp, int flag,
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 @@ static int do_dumpqca_flash_data(cmd_tbl_t *cmdtp, int flag,
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

View file

@ -370,7 +370,11 @@ void autoboot_command(const char *s)
*/
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