diff options
author | Jim Quigley <jim.quigley@arm.com> | 2020-08-07 14:53:59 +0100 |
---|---|---|
committer | Chris Kay <chris@cjkay.com> | 2020-08-13 10:09:25 +0100 |
commit | 0f6486aaf53fdb75d25c96a095f3cae7d646d7ee (patch) | |
tree | aeac9f277f69f27024c16f7ca4284e5f09f316d0 /product/sgm775 | |
parent | 7b174da42e00fb0387818a9494088e69bcc566d7 (diff) |
SCMI: Add platform-specific resource permissions handlers
This patch adds resource management handlers for platforms which
implement vendor or platform-specific entensions to the SCMI
specification.
Change-Id: Ic6b666eeab546571c6acbd70421c979e9d3148ce
Signed-off-by: Jim Quigley <jim.quigley@arm.com>
Diffstat (limited to 'product/sgm775')
-rw-r--r-- | product/sgm775/scp_ramfw/config_resource_perms.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/product/sgm775/scp_ramfw/config_resource_perms.c b/product/sgm775/scp_ramfw/config_resource_perms.c index b7189af2..3ecc2b18 100644 --- a/product/sgm775/scp_ramfw/config_resource_perms.c +++ b/product/sgm775/scp_ramfw/config_resource_perms.c @@ -8,6 +8,7 @@ #include "sgm775_scmi.h" #include <mod_resource_perms.h> +#include <mod_scmi_apcore.h> #include <mod_scmi_std.h> #include <fwk_element.h> @@ -95,6 +96,64 @@ static struct mod_res_agent_msg_permissions agent_msg_permissions[] = { }, }; +/* + * Check whether an agent has access to a protocol. + * + * Note that we will always check the higher permissions levels + * when called, so + * + * protocol -> message -> resource + * + * This overrides the version in the resource_perms module + * for the platform specific protocols. + */ +enum mod_res_perms_permissions mod_res_plat_agent_protocol_permissions( + uint32_t agent_id, + uint32_t protocol_id) +{ + if (protocol_id == MOD_SCMI_PROTOCOL_ID_APCORE) + return MOD_RES_PERMS_ACCESS_ALLOWED; + + return MOD_RES_PERMS_ACCESS_DENIED; +} + +/* + * Check whether an agent can access a protocol:message. + * + * This overrides the version in the resource_perms module + * for the platform specific protocol:messages. + */ +enum mod_res_perms_permissions mod_res_plat_agent_message_permissions( + uint32_t agent_id, + uint32_t protocol_id, + uint32_t message_id) +{ + if ((protocol_id == MOD_SCMI_PROTOCOL_ID_APCORE) && + (message_id <= MOD_SCMI_APCORE_RESET_ADDRESS_GET)) + return MOD_RES_PERMS_ACCESS_ALLOWED; + + return MOD_RES_PERMS_ACCESS_DENIED; +} + +/* + * Check the permissions for agent:protocol:message:resource. + * + * This overrides the version in the resource_perms module + * for the platform specific protocol:message:resources. + */ +enum mod_res_perms_permissions mod_res_plat_agent_resource_permissions( + uint32_t agent_id, + uint32_t protocol_id, + uint32_t message_id, + uint32_t resource_id) +{ + if ((protocol_id == MOD_SCMI_PROTOCOL_ID_APCORE) && + (message_id <= MOD_SCMI_APCORE_RESET_ADDRESS_GET)) + return MOD_RES_PERMS_ACCESS_ALLOWED; + + return MOD_RES_PERMS_ACCESS_DENIED; +} + static struct mod_res_agent_permission agent_permissions = { .agent_protocol_permissions = agent_protocol_permissions, .agent_msg_permissions = agent_msg_permissions, |