added qdl support for emmc storage use option --s emmc or ufs as argument to qdl command by default storage would be ufs
Signed-off-by: laxman laxman@inforcecomputing.com
--- v2 -added [--storage <emmc|ufs>] suggestion from nicolas --- firehose.c | 16 ++++++++-------- qdl.c | 10 +++++++--- qdl.h | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/firehose.c b/firehose.c index c4e9500..466a26d 100644 --- a/firehose.c +++ b/firehose.c @@ -265,7 +265,7 @@ static int firehose_configure_response_parser(xmlNode *node) return max_size; }
-static int firehose_send_configure(int fd, size_t payload_size, bool skip_storage_init) +static int firehose_send_configure(int fd, size_t payload_size, bool skip_storage_init, const char *storage) { xmlNode *root; xmlNode *node; @@ -277,7 +277,7 @@ static int firehose_send_configure(int fd, size_t payload_size, bool skip_storag xmlDocSetRootElement(doc, root);
node = xmlNewChild(root, NULL, (xmlChar*)"configure", NULL); - xml_setpropf(node, "MemoryName", "ufs"); + xml_setpropf(node, "MemoryName", storage); xml_setpropf(node, "MaxPayloadSizeToTargetInBytes", "%d", payload_size); xml_setpropf(node, "verbose", "%d", 0); xml_setpropf(node, "ZLPAwareHost", "%d", 0); @@ -291,17 +291,17 @@ static int firehose_send_configure(int fd, size_t payload_size, bool skip_storag return firehose_read(fd, -1, firehose_configure_response_parser); }
-static int firehose_configure(int fd, bool skip_storage_init) +static int firehose_configure(int fd, bool skip_storage_init, const char *storage) { int ret;
- ret = firehose_send_configure(fd, max_payload_size, skip_storage_init); + ret = firehose_send_configure(fd, max_payload_size, skip_storage_init, storage); if (ret < 0) return ret;
/* Retry if remote proposed different size */ if (ret != max_payload_size) { - ret = firehose_send_configure(fd, ret, skip_storage_init); + ret = firehose_send_configure(fd, ret, skip_storage_init, storage); if (ret < 0) return ret;
@@ -601,7 +601,7 @@ static int firehose_reset(int fd) return firehose_read(fd, -1, firehose_nop_parser); }
-int firehose_run(int fd, const char *incdir) +int firehose_run(int fd, const char *incdir, const char *storage) { int bootable; int ret; @@ -618,7 +618,7 @@ int firehose_run(int fd, const char *incdir) return ret;
if(ufs_need_provisioning()) { - ret = firehose_configure(fd, true); + ret = firehose_configure(fd, true, storage); if (ret) return ret; ret = ufs_provisioning_execute(fd, firehose_apply_ufs_common, @@ -630,7 +630,7 @@ int firehose_run(int fd, const char *incdir) return ret; }
- ret = firehose_configure(fd, false); + ret = firehose_configure(fd, false, storage); if (ret) return ret;
diff --git a/qdl.c b/qdl.c index 8cf1011..ee18663 100644 --- a/qdl.c +++ b/qdl.c @@ -220,14 +220,14 @@ static void print_usage(void) { extern const char *__progname; fprintf(stderr, - "%s [--debug] [--finalize-provisioning] [--include <PATH>] <prog.mbn> [<program> <patch> ...]\n", + "%s [--debug] [--storage <emmc|ufs>][--finalize-provisioning] [--include <PATH>] <prog.mbn> [<program> <patch> ...]\n", __progname); }
int main(int argc, char **argv) { struct termios tios; - char *prog_mbn; + char *prog_mbn, *storage="ufs"; char *incdir = NULL; int type; int ret; @@ -240,6 +240,7 @@ int main(int argc, char **argv) {"debug", no_argument, 0, 'd'}, {"include", required_argument, 0, 'i'}, {"finalize-provisioning", no_argument, 0, 'l'}, + {"storage", required_argument, 0, 's'}, {0, 0, 0, 0} };
@@ -254,6 +255,9 @@ int main(int argc, char **argv) case 'l': qdl_finalize_provisioning = true; break; + case 's': + storage = optarg; + break; default: print_usage(); return 1; @@ -303,7 +307,7 @@ int main(int argc, char **argv) if (ret < 0) goto out;
- ret = firehose_run(fd, incdir); + ret = firehose_run(fd, incdir, storage);
out: ret = tcsetattr(fd, TCSANOW, &tios); diff --git a/qdl.h b/qdl.h index 0ed2607..208ede0 100644 --- a/qdl.h +++ b/qdl.h @@ -6,7 +6,7 @@ #include "patch.h" #include "program.h"
-int firehose_run(int fd, const char *incdir); +int firehose_run(int fd, const char *incdir, const char *storage); int sahara_run(int fd, char *prog_mbn); void print_hex_dump(const char *prefix, const void *buf, size_t len);