thor: Bump protocol version to 5.0 96/227996/2
authorDongwoo Lee <dwoo08.lee@samsung.com>
Wed, 18 Mar 2020 03:35:59 +0000 (12:35 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Wed, 18 Mar 2020 05:52:49 +0000 (14:52 +0900)
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 <dwoo08.lee@samsung.com>
src/thor-proto.h
src/thor.c

index f384b46..c26aefd 100644 (file)
@@ -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)
index d6dfa09..e19d33f 100644 (file)
@@ -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;