Merge "ipq807x: Splitting EBICS dump if the size is greater than 1GB"

This commit is contained in:
Linux Build Service Account 2017-08-04 08:02:16 -07:00 committed by Gerrit - the friendly Code Review server
commit d3329bc9cf
4 changed files with 85 additions and 27 deletions

View file

@ -339,6 +339,26 @@ int qca_scm_call(u32 svc_id, u32 cmd_id, void *buf, size_t len)
return ret;
}
int qca_scm_fuseipq(u32 svc_id, u32 cmd_id, void *buf, size_t len)
{
int ret = 0;
uint32_t *status;
#ifdef CONFIG_SCM_TZ64
struct qca_scm_desc desc = {0};
desc.arginfo = QCA_SCM_ARGS(1, SCM_READ_OP);
desc.args[0] = *((unsigned int *)buf);
ret = scm_call_64(svc_id, cmd_id, &desc);
status = (uint32_t *)(*(((uint32_t *)buf) + 1));
*status = desc.ret[0];
#else
ret = scm_call(svc_id, cmd_id, buf, len, NULL, 0);
#endif
return ret;
}
int qca_scm_auth_kernel(void *cmd_buf,
size_t cmd_len)
{

View file

@ -99,6 +99,7 @@ extern int qca_scm_call(u32 svc_id, u32 cmd_id, void *buf, size_t len);
int qca_scm_call_write(u32, u32, u32 *, u32);
int qca_scm_call_read(u32, u32, u32 *, u32 *);
int qca_scm_sdi_v8(void);
int qca_scm_fuseipq(u32, u32, void *, size_t);
#define MAX_QCA_SCM_RETS 3
#define MAX_QCA_SCM_ARGS 10

View file

@ -45,9 +45,8 @@ int do_fuseipq(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
fuseip.address = simple_strtoul(argv[1], NULL, 16);
fuseip.status = (uint32_t)&fuse_status;
ret = scm_call(SCM_SVC_FUSE, TZ_BLOW_FUSE_SECDAT,
&fuseip, sizeof(fuseip), NULL, 0);
ret = qca_scm_fuseipq(SCM_SVC_FUSE, TZ_BLOW_FUSE_SECDAT,
&fuseip, sizeof(fuseip));
if (ret || fuse_status)
printf("%s: Error in QFPROM write (%d, %d)\n",

View file

@ -32,6 +32,7 @@
#define DLOAD_MAGIC_COOKIE 0x10
#define XMK_STR(x)#x
#define MK_STR(x)XMK_STR(x)
#define MAX_TFTP_SIZE 0x40000000
static int debug = 0;
static char mtdids[256];
@ -69,15 +70,52 @@ kernel_img_info_t kernel_img_info;
char dtb_config_name[64];
static int tftpdump (int is_aligned_access, uint32_t memaddr, uint32_t size, char *name)
{
char runcmd[128];
char *dumpdir;
if ((dumpdir = getenv("dumpdir")) != NULL) {
printf("Using directory %s in TFTP server\n", dumpdir);
} else {
dumpdir = "";
printf("Env 'dumpdir' not set. Using / dir in TFTP server\n");
}
if (is_aligned_access) {
if (IPQ_TEMP_DUMP_ADDR) {
snprintf(runcmd, sizeof(runcmd), "cp.l 0x%x 0x%x 0x%x", memaddr,
IPQ_TEMP_DUMP_ADDR, size / 4);
if (run_command(runcmd, 0) != CMD_RET_SUCCESS)
return CMD_RET_FAILURE;
memaddr = IPQ_TEMP_DUMP_ADDR;
} else {
printf("%s needs aligned access and temp address is not defined. Skipping...", name);
return CMD_RET_FAILURE;
}
}
snprintf(runcmd, sizeof(runcmd), "tftpput 0x%x 0x%x %s/%s",
memaddr, size, dumpdir, name);
if (run_command(runcmd, 0) != CMD_RET_SUCCESS)
return CMD_RET_FAILURE;
return CMD_RET_SUCCESS;
}
static int do_dumpqca_data(cmd_tbl_t *cmdtp, int flag, int argc,
char *const argv[])
{
char runcmd[128];
char *serverip = NULL;
/* dump to root of TFTP server if none specified */
char *dumpdir;
uint32_t memaddr;
uint32_t remaining;
int indx;
int ebi_indx = 0;
int ret = CMD_RET_FAILURE;
if (argc == 2) {
serverip = argv[1];
@ -92,40 +130,40 @@ static int do_dumpqca_data(cmd_tbl_t *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
}
if ((dumpdir = getenv("dumpdir")) != NULL) {
printf("Using directory %s in TFTP server\n", dumpdir);
} else {
dumpdir = "";
printf("Env 'dumpdir' not set. Using / dir in TFTP server\n");
}
for (indx = 0; indx < dump_entries; indx++) {
printf("\nProcessing %s:", dumpinfo[indx].name);
memaddr = dumpinfo[indx].start;
if (!strncmp(dumpinfo[indx].name, "EBICS0.BIN", strlen("EBICS0.BIN")))
if (!strncmp(dumpinfo[indx].name, "EBICS", strlen("EBICS")))
{
dumpinfo[indx].size = gd->ram_size;
remaining = dumpinfo[indx].size;
while (remaining > 0) {
snprintf(dumpinfo[indx].name, sizeof(dumpinfo[indx].name), "EBICS%d.BIN", ebi_indx);
if (dumpinfo[indx].is_aligned_access) {
if (IPQ_TEMP_DUMP_ADDR) {
snprintf(runcmd, sizeof(runcmd), "cp.l 0x%x 0x%x 0x%x", memaddr,
IPQ_TEMP_DUMP_ADDR, dumpinfo[indx].size / 4);
if (run_command(runcmd, 0) != CMD_RET_SUCCESS)
if (remaining > MAX_TFTP_SIZE) {
dumpinfo[indx].size = MAX_TFTP_SIZE;
}
else {
dumpinfo[indx].size = remaining;
}
ret = tftpdump (dumpinfo[indx].is_aligned_access, memaddr, dumpinfo[indx].size, dumpinfo[indx].name);
if (ret == CMD_RET_FAILURE)
return CMD_RET_FAILURE;
memaddr = IPQ_TEMP_DUMP_ADDR;
} else {
printf("%s needs aligned access and temp address is not defined. Skipping...", dumpinfo[indx].name);
continue;
memaddr += dumpinfo[indx].size;
remaining -= dumpinfo[indx].size;
ebi_indx++;
}
}
else
{
ret = tftpdump (dumpinfo[indx].is_aligned_access, memaddr, dumpinfo[indx].size, dumpinfo[indx].name);
if (ret == CMD_RET_FAILURE)
return CMD_RET_FAILURE;
}
snprintf(runcmd, sizeof(runcmd), "tftpput 0x%x 0x%x %s/%s",
memaddr, dumpinfo[indx].size,
dumpdir, dumpinfo[indx].name);
if (run_command(runcmd, 0) != CMD_RET_SUCCESS)
return CMD_RET_FAILURE;
udelay(10000); /* give some delay for server */
}
return CMD_RET_SUCCESS;