diff options
author | Luca Vizzarro <Luca.Vizzarro@arm.com> | 2020-10-07 14:14:12 +0100 |
---|---|---|
committer | nicola-mazzucato-arm <42373140+nicola-mazzucato-arm@users.noreply.github.com> | 2020-10-22 14:39:59 +0100 |
commit | 61a7df422be8f5a0cc469900e4ca837085716bcd (patch) | |
tree | b4deb4b3329c9b5f71ad29adebc7f3578570cada | |
parent | 4fa85a06902f83992fda519d777128322a5ad5d5 (diff) |
mod_scmi_clock: Fix rate_set invalid params
The SCMI v2 specs defines that the RATE_SET command flags bits 31:4 are
reserved and must be zero. This commit fixes this behaviour by returning
INVALID_PARAMETERS as expected when any of these are set.
Change-Id: Ib217bbfa4aa52f1c9051906bb88db76e0422ec1c
Signed-off-by: Luca Vizzarro <Luca.Vizzarro@arm.com>
-rw-r--r-- | module/scmi_clock/include/internal/scmi_clock.h | 4 | ||||
-rw-r--r-- | module/scmi_clock/src/mod_scmi_clock.c | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/module/scmi_clock/include/internal/scmi_clock.h b/module/scmi_clock/include/internal/scmi_clock.h index da5b3a8c..b2014125 100644 --- a/module/scmi_clock/include/internal/scmi_clock.h +++ b/module/scmi_clock/include/internal/scmi_clock.h @@ -158,6 +158,10 @@ struct scmi_clock_rate_get_p2a { (UINT32_C(0x1) << SCMI_CLOCK_RATE_SET_ROUND_UP_POS) #define SCMI_CLOCK_RATE_SET_ROUND_AUTO_MASK \ (UINT32_C(0x1) << SCMI_CLOCK_RATE_SET_ROUND_AUTO_POS) +#define SCMI_CLOCK_RATE_SET_FLAGS_MASK \ + (SCMI_CLOCK_RATE_SET_ASYNC_MASK | \ + SCMI_CLOCK_RATE_SET_NO_DELAYED_RESPONSE_MASK | \ + SCMI_CLOCK_RATE_SET_ROUND_UP_POS | SCMI_CLOCK_RATE_SET_ROUND_AUTO_POS) struct scmi_clock_rate_set_a2p { uint32_t flags; diff --git a/module/scmi_clock/src/mod_scmi_clock.c b/module/scmi_clock/src/mod_scmi_clock.c index 1584c810..dd7f5d4b 100644 --- a/module/scmi_clock/src/mod_scmi_clock.c +++ b/module/scmi_clock/src/mod_scmi_clock.c @@ -852,6 +852,11 @@ static int scmi_clock_rate_set_handler(fwk_id_t service_id, round_auto = parameters->flags & SCMI_CLOCK_RATE_SET_ROUND_AUTO_MASK; asynchronous = parameters->flags & SCMI_CLOCK_RATE_SET_ASYNC_MASK; + if ((parameters->flags & ~SCMI_CLOCK_RATE_SET_FLAGS_MASK) != 0) { + return_values.status = SCMI_INVALID_PARAMETERS; + goto exit; + } + status = get_clock_device_entry(service_id, parameters->clock_id, &clock_device, |