diff options
author | Luca Vizzarro <Luca.Vizzarro@arm.com> | 2020-10-08 19:32:50 +0100 |
---|---|---|
committer | nicola-mazzucato-arm <42373140+nicola-mazzucato-arm@users.noreply.github.com> | 2020-10-22 14:39:59 +0100 |
commit | f17fa7b42c3c48236bff9cdb717f0e58ffa907a8 (patch) | |
tree | e79fd36ead6e5f023e162d4ba39353a9372dd05b | |
parent | 2d55e0556f55e89566acf20d9f5f88c2f0b1ef3e (diff) |
mod_scmi_reset: Fix RESET invalid reset_state
As per section 4.8.1 of the SCMI v2 spec, the only valid reset id for
the Architectural reset state type is 0. All the other IDs available in
the 32-bit space are reserved for future use. This commit brings an
early exit condition that returns SCMI_INVALID_PARAMETERS when it
detects that any of those ids are used.
Change-Id: I81d7aee541e7577e58e242da6bebf14edd00b753
Signed-off-by: Luca Vizzarro <Luca.Vizzarro@arm.com>
-rw-r--r-- | module/scmi_reset_domain/include/internal/scmi_reset_domain.h | 3 | ||||
-rw-r--r-- | module/scmi_reset_domain/src/mod_scmi_reset_domain.c | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/module/scmi_reset_domain/include/internal/scmi_reset_domain.h b/module/scmi_reset_domain/include/internal/scmi_reset_domain.h index bedd4273..38dcc77f 100644 --- a/module/scmi_reset_domain/include/internal/scmi_reset_domain.h +++ b/module/scmi_reset_domain/include/internal/scmi_reset_domain.h @@ -71,6 +71,9 @@ struct scmi_reset_domain_attributes_p2a { (SCMI_RESET_DOMAIN_ASYNC | SCMI_RESET_DOMAIN_EXPLICIT | \ SCMI_RESET_DOMAIN_AUTO) +#define SCMI_RESET_DOMAIN_RESET_STATE_TYPE_MASK (1UL << 31) +#define SCMI_RESET_DOMAIN_RESET_STATE_ID_MASK UINT32_C(0x7FFFFFFF) + struct scmi_reset_domain_request_a2p { uint32_t domain_id; uint32_t flags; diff --git a/module/scmi_reset_domain/src/mod_scmi_reset_domain.c b/module/scmi_reset_domain/src/mod_scmi_reset_domain.c index 895cfbac..e18326a5 100644 --- a/module/scmi_reset_domain/src/mod_scmi_reset_domain.c +++ b/module/scmi_reset_domain/src/mod_scmi_reset_domain.c @@ -314,6 +314,17 @@ static int reset_request_handler(fwk_id_t service_id, goto exit; } + /** + * Verify that the reset state ID is 0 when the reset + * state type is Architectural. + */ + if (((params.reset_state & SCMI_RESET_DOMAIN_RESET_STATE_TYPE_MASK) == 0) && + ((params.reset_state & SCMI_RESET_DOMAIN_RESET_STATE_ID_MASK) != 0)) { + status = FWK_SUCCESS; + outmsg.status = SCMI_INVALID_PARAMETERS; + goto exit; + } + status = scmi_rd_ctx.scmi_api->get_agent_id(service_id, &agent_id); if (status != FWK_SUCCESS) goto exit; |