From ebfe553da8a45dfdeafd88aeff97ffc9862f62f4 Mon Sep 17 00:00:00 2001 From: Gokul Sriram Palanisamy Date: Mon, 29 Jan 2018 13:18:16 +0530 Subject: [PATCH] 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 --- arch/arm/include/asm/arch-qca-common/qca_common.h | 1 + board/qca/arm/common/cmd_bootqca.c | 11 ++--------- common/autoboot.c | 6 +++++- 3 files changed, 8 insertions(+), 10 deletions(-) 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 68a8375703..28529b9d98 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 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{ diff --git a/board/qca/arm/common/cmd_bootqca.c b/board/qca/arm/common/cmd_bootqca.c index fe7a5067c2..4fa5ad0bbd 100644 --- a/board/qca/arm/common/cmd_bootqca.c +++ b/board/qca/arm/common/cmd_bootqca.c @@ -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 diff --git a/common/autoboot.c b/common/autoboot.c index 75fe0f3df9..751abe7e9e 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -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