From e25f9362dd6b7230b2f0696ea07b139c1ccfd29f Mon Sep 17 00:00:00 2001 From: Wendy Liang Date: Tue, 10 Jan 2017 16:14:49 -0800 Subject: [PATCH] remoteproc: resource table: add fw checksum rsc Add firmware checksum resource type to resource table. It can be used for the master to check if the remote runs on the expected firmware if it is still running before it tries to boot the remote. Signed-off-by: Wendy Liang --- lib/include/openamp/remoteproc.h | 19 ++++++++++++++++++- lib/include/openamp/rsc_table_parser.h | 1 + lib/remoteproc/rsc_table_parser.c | 22 ++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/lib/include/openamp/remoteproc.h b/lib/include/openamp/remoteproc.h index e76b04f..95f5d19 100644 --- a/lib/include/openamp/remoteproc.h +++ b/lib/include/openamp/remoteproc.h @@ -113,7 +113,8 @@ enum fw_resource_type { RSC_TRACE = 2, RSC_VDEV = 3, RSC_RPROC_MEM = 4, - RSC_LAST = 5, + RSC_FW_CHKSUM = 5, + RSC_LAST = 6, }; #define FW_RSC_ADDR_ANY (0xFFFFFFFFFFFFFFFF) @@ -334,6 +335,22 @@ struct fw_rsc_rproc_mem { uint32_t reserved; } OPENAMP_PACKED_END; +/* + * struct fw_rsc_fw_chksum - firmware checksum + * @algo: algorithm to generate the cheksum + * @chksum: checksum of the firmware loadable sections. + * + * This resource entry provides checksum for the firmware loadable sections. + * It is used to check if the remote already runs with the expected firmware to + * decide if it needs to start the remote if the remote is already running. + */ +OPENAMP_PACKED_BEGIN +struct fw_rsc_fw_chksum { + uint32_t type; + uint8_t algo[16]; + uint8_t chksum[64]; +} OPENAMP_PACKED_END; + /** * struct remote_proc * diff --git a/lib/include/openamp/rsc_table_parser.h b/lib/include/openamp/rsc_table_parser.h index 0b35d18..0c9929d 100644 --- a/lib/include/openamp/rsc_table_parser.h +++ b/lib/include/openamp/rsc_table_parser.h @@ -49,6 +49,7 @@ int handle_trace_rsc(struct remote_proc *rproc, void *rsc); int handle_dev_mem_rsc(struct remote_proc *rproc, void *rsc); int handle_vdev_rsc(struct remote_proc *rproc, void *rsc); int handle_rproc_mem_rsc(struct remote_proc *rproc, void *rsc); +int handle_fw_chksum_rsc(struct remote_proc *rproc, void *rsc); int handle_mmu_rsc(struct remote_proc *rproc, void *rsc); #endif /* RSC_TABLE_PARSER_H */ diff --git a/lib/remoteproc/rsc_table_parser.c b/lib/remoteproc/rsc_table_parser.c index 30534c6..cb42825 100644 --- a/lib/remoteproc/rsc_table_parser.c +++ b/lib/remoteproc/rsc_table_parser.c @@ -37,6 +37,7 @@ rsc_handler rsc_handler_table[] = { handle_trace_rsc, handle_vdev_rsc, handle_rproc_mem_rsc, + handle_fw_chksum_rsc, handle_mmu_rsc }; @@ -254,6 +255,27 @@ int handle_rproc_mem_rsc(struct remote_proc *rproc, void *rsc) return RPROC_SUCCESS; } +/* + * handle_fw_chksum_rsc + * + * This function parses firmware checksum resource. + * + * @param rproc - pointer to remote remote_proc + * @param rsc - pointer to mmu resource + * + * @returns - execution status + * + */ +int handle_fw_chksum_rsc(struct remote_proc *rproc, void *rsc) +{ + (void)rproc; + (void)rsc; + + /* TODO: the firmware side should handle this resource properly + * when it is the master or when it is the remote. */ + return RPROC_SUCCESS; +} + /** * handle_mmu_rsc * -- 2.26.2