From 29950f08d56bd278a198463489be60d6bbdba49c Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Wed, 18 Mar 2020 12:35:59 +0900 Subject: [PATCH] thor: Bump protocol version to 5.0 To support the images exceeds 4GB, thor protocol 5.0 is applied. This requires thor client support: Ref: https://git.tizen.org/cgit/tools/lthor/commit/?id=30fa9f0cbfc4b089bb7e733b9cb75a60e1d10369 u-boot thor downloader already supports protocol 5.0: Ref: https://gitlab.denx.de/u-boot/u-boot/-/commit/1fe9ae76b113103bcc40aa15949f9dd8aa0a06a2 Change-Id: I149361ca2f40b5775249f3672e3e19b2f6394b68 Signed-off-by: Dongwoo Lee --- src/thor-proto.h | 2 +- src/thor.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/thor-proto.h b/src/thor-proto.h index f384b46..c26aefd 100644 --- a/src/thor-proto.h +++ b/src/thor-proto.h @@ -84,7 +84,7 @@ struct data_res_pkt { int32_t cnt; /* Int. Datas. */ } __attribute__((__packed__)); -#define VER_PROTOCOL_MAJOR 4 +#define VER_PROTOCOL_MAJOR 5 #define VER_PROTOCOL_MINOR 0 #define RQT_PKT_SIZE sizeof(struct rqt_pkt) diff --git a/src/thor.c b/src/thor.c index d6dfa09..e19d33f 100644 --- a/src/thor.c +++ b/src/thor.c @@ -216,7 +216,8 @@ static int thor_process_rqt_download(struct tfm_context *ctx, struct rqt_pkt *rq switch (rqt->sub_id) { case RQT_DL_INIT: - ctx->thor_file_size = (unsigned long)rqt->int_data[0]; + ctx->thor_file_size = (uint64_t)rqt->int_data[0] + + ((uint64_t)rqt->int_data[1] << 32); break; case RQT_DL_FILE_INFO: file_type = rqt->int_data[0]; @@ -226,7 +227,8 @@ static int thor_process_rqt_download(struct tfm_context *ctx, struct rqt_pkt *rq break; } - ctx->thor_file_size = (unsigned long)rqt->int_data[1]; + ctx->thor_file_size = (uint64_t)rqt->int_data[1] + + ((uint64_t)rqt->int_data[2] << 32); memcpy(f_name, rqt->str_data[0], FILE_NAME_MAXLEN); rsp.int_data[0] = DATA_PKT_SIZE; -- 2.34.1