mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2025-12-10 07:44:53 +01:00
ARM: qca: Skipping u-boot prompt during crashdump
If crashdump magic is found, should not allow user to access u-boot prompt as tz will be in unsecure state. Change-Id: I081e84eceada7ffe72d9b4fa4f0425535e4aabde Signed-off-by: Gokul Sriram Palanisamy <gokulsri@codeaurora.org>
This commit is contained in:
parent
7b2d4846e7
commit
7e12e80ba8
3 changed files with 36 additions and 22 deletions
|
|
@ -50,6 +50,7 @@ int qca_mmc_init(bd_t *, qca_mmc *);
|
|||
void board_mmc_deinit(void);
|
||||
|
||||
void set_flash_secondary_type(qca_smem_flash_info_t *);
|
||||
int qca_iscrashed(void);
|
||||
|
||||
struct dumpinfo_t{
|
||||
char name[16]; /* use only file name in 8.3 format */
|
||||
|
|
|
|||
|
|
@ -193,26 +193,6 @@ static int do_dumpqca_data(void)
|
|||
* requested to stop
|
||||
*/
|
||||
#ifdef CONFIG_QCA_APPSBL_DLOAD
|
||||
static int inline do_dumpipq_data(void)
|
||||
{
|
||||
uint64_t etime;
|
||||
|
||||
if (do_dumpqca_data() != CMD_RET_SUCCESS) {
|
||||
printf("\nAuto crashdump saving failed!"
|
||||
"\nPress any key within 10s to take control of U-Boot");
|
||||
|
||||
etime = get_timer_masked() + (10 * CONFIG_SYS_HZ);
|
||||
while (get_timer_masked() < etime) {
|
||||
if (tstc())
|
||||
break;
|
||||
}
|
||||
|
||||
if (get_timer_masked() < etime)
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
static int dump_func(void)
|
||||
{
|
||||
uint64_t etime;
|
||||
|
|
@ -227,8 +207,8 @@ static int dump_func(void)
|
|||
"\nHit any key within 10s to stop dump activity...");
|
||||
while (!tstc()) { /* while no incoming data */
|
||||
if (get_timer_masked() >= etime) {
|
||||
if (do_dumpipq_data() == CMD_RET_FAILURE)
|
||||
return CMD_RET_FAILURE;
|
||||
if (do_dumpqca_data() == CMD_RET_FAILURE)
|
||||
printf("Crashdump saving failed!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -239,6 +219,30 @@ static int dump_func(void)
|
|||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
int qca_iscrashed(void)
|
||||
{
|
||||
u32 *addr = (u32 *)0x193D100;
|
||||
unsigned long * dmagic1 = (unsigned long *) 0x2A03F000;
|
||||
unsigned long * dmagic2 = (unsigned long *) 0x2A03F004;
|
||||
volatile u32 val;
|
||||
u32 rsp;
|
||||
int ret;
|
||||
|
||||
if (is_scm_armv8()) {
|
||||
ret = qca_scm_call_read(SCM_SVC_IO, SCM_IO_READ, addr, &rsp);
|
||||
|
||||
if (rsp == DLOAD_MAGIC_COOKIE)
|
||||
return 1;
|
||||
} else {
|
||||
ret = qca_scm_call(SCM_SVC_BOOT, SCM_SVC_RD,
|
||||
(void *)&val, sizeof(val));
|
||||
if (val == DLOAD_MAGIC_COOKIE
|
||||
|| ret && *dmagic1 == 0xE47B337D && *dmagic2 == 0x0501CAB0)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qca_appsbl_dload(void) {
|
||||
int ret = 0;
|
||||
u32 rsp = 0;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include <menu.h>
|
||||
#include <post.h>
|
||||
#include <u-boot/sha256.h>
|
||||
#include <asm/arch-qca-common/qca_common.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
|
|
@ -283,6 +284,14 @@ static int abortboot_normal(int bootdelay)
|
|||
|
||||
static int abortboot(int bootdelay)
|
||||
{
|
||||
#ifdef CONFIG_QCA_APPSBL_DLOAD
|
||||
/* If kernel has crashed in previous boot, skipping abortboot */
|
||||
if (qca_iscrashed()) {
|
||||
printf("Crashdump magic found, initializing dump activity..\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_AUTOBOOT_KEYED
|
||||
return abortboot_keyed(bootdelay);
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue