aboutsummaryrefslogtreecommitdiff
path: root/module/resource_perms
diff options
context:
space:
mode:
authorJim Quigley <jim.quigley@arm.com>2020-07-20 12:54:38 +0100
committerChris Kay <chris@cjkay.com>2020-07-31 16:40:53 +0100
commitbdccb0c7bf3e3337accf734911c1b062915b2de3 (patch)
tree1b2655cc3ff3f3989ad694dcab4968d4adf7c424 /module/resource_perms
parentb851b65bb464da61e598db270e956ad4e403fc8a (diff)
SCMI: Device permissions
This patch adds the basic definitions for SCMI device permissions management. Change-Id: Iee4de39de514275cd2692165e6d3728e1bbf98db Signed-off-by: Jim Quigley <jim.quigley@arm.com>
Diffstat (limited to 'module/resource_perms')
-rw-r--r--module/resource_perms/include/mod_resource_perms.h93
-rw-r--r--module/resource_perms/src/mod_resource_perms.c47
2 files changed, 139 insertions, 1 deletions
diff --git a/module/resource_perms/include/mod_resource_perms.h b/module/resource_perms/include/mod_resource_perms.h
index 9d223651..0a1284d9 100644
--- a/module/resource_perms/include/mod_resource_perms.h
+++ b/module/resource_perms/include/mod_resource_perms.h
@@ -15,6 +15,7 @@
#include <mod_scmi_std.h>
#include <fwk_assert.h>
+#include <fwk_id.h>
#include <fwk_status.h>
#include <stdint.h>
@@ -267,6 +268,44 @@ enum mod_res_reset_domain_permissions_idx {
};
/*!
+ * \brief SCMI Domain Types
+ */
+enum mod_res_domain_device_types {
+ MOD_RES_POWER_DOMAIN_DEVICE = 0,
+ MOD_RES_PERF_DOMAIN_DEVICE,
+ MOD_RES_CLOCK_DOMAIN_DEVICE,
+ MOD_RES_SENSOR_DOMAIN_DEVICE,
+ MOD_RES_RESET_DOMAIN_DEVICE,
+ MOD_RES_PLATFORM_DOMAIN_DEVICE,
+ MOD_RES_DOMAIN_DEVICE_INVALID
+};
+
+/*!
+ * \brief Each device is made up multiple domain devices.
+ * The protocol is determined by the device type.
+ * The resource ID for a protocol is the element ID of the
+ * device_id.
+ */
+struct mod_res_domain_device {
+ /*! \brief Identifier of the domain device instance */
+ fwk_id_t device_id;
+
+ /*! \brief Type of the domain device instance */
+ enum mod_res_domain_device_types type;
+};
+
+/*!
+ * \brief Device definition.
+ */
+struct mod_res_device {
+ /*! \brief Device Identifier */
+ uint16_t device_id;
+
+ /*! \brief List of domain devices in the device */
+ struct mod_res_domain_device *domain_devices;
+};
+
+/*!
* \brief SCMI Agent Permissions
*
* \details An agent may have any combination of the permissions
@@ -359,6 +398,52 @@ struct mod_res_permissions_api {
uint32_t protocol_id,
uint32_t message_id,
uint32_t resource_id);
+
+ /*!
+ * \brief Set device permissions for an agent
+ *
+ * \param agent_id identifier of the agent.
+ * \param device_id identifier of the device.
+ * \param flags permissions to set.
+ *
+ * \retval FWK_SUCCESS The operation has completed successfully.
+ * \retval FWK_E_PARAM Unknown agent_id or device_id.
+ * \retval FWK_E_INVAL Invalid flags.
+ */
+ int (*agent_set_device_permission)(
+ uint32_t agent_id,
+ uint32_t device_id,
+ uint32_t flags);
+
+ /*!
+ * \brief Set device protocol permissions for an agent
+ *
+ * \param agent_id identifier of the agent.
+ * \param device_id identifier of the device.
+ * \param device_id identifier of the protocol.
+ * \param flags permissions to set.
+ *
+ * \retval FWK_SUCCESS The operation has completed successfully.
+ * \retval FWK_E_PARAM Unknown agent_id or device_id.
+ * \retval FWK_E_INVAL Invalid flags or protocol_ID.
+ */
+ int (*agent_set_device_protocol_permission)(
+ uint32_t agent_id,
+ uint32_t device_id,
+ uint32_t protocol_id,
+ uint32_t flags);
+
+ /*!
+ * \brief Reset permissions for an agent
+ *
+ * \param agent_id identifier of the agent.
+ * \param flags permissions to set.
+ *
+ * \retval FWK_SUCCESS The operation has completed successfully.
+ * \retval FWK_E_PARAM Unknown agent_id.
+ * \retval FWK_E_INVAL Invalid flags.
+ */
+ int (*agent_reset_config)(uint32_t agent_id, uint32_t flags);
};
/*!
@@ -387,12 +472,18 @@ struct mod_res_resource_perms_config {
uint32_t perf_count;
#ifdef BUILD_HAS_SCMI_RESET
- /*! \brief Number of performance domains supported by the platform. */
+ /*! \brief Number of reset domains supported by the platform. */
uint32_t reset_domain_count;
#endif
+ /*! \brief Number of devices supported by the platform. */
+ uint32_t device_count;
+
/*! \brief Address of the permissions table */
uintptr_t agent_permissions;
+
+ /*! \brief Address of the domain devices */
+ uintptr_t domain_devices;
};
/*!
diff --git a/module/resource_perms/src/mod_resource_perms.c b/module/resource_perms/src/mod_resource_perms.c
index 410f4d86..b4155577 100644
--- a/module/resource_perms/src/mod_resource_perms.c
+++ b/module/resource_perms/src/mod_resource_perms.c
@@ -39,6 +39,9 @@ struct res_perms_ctx {
/*! Number of performance domain resources for the platform. */
uint32_t perf_count;
+ /*! Number of devices for the platform. */
+ uint32_t device_count;
+
#ifdef BUILD_HAS_SCMI_RESET
/*! Number of reset domain resources for the platform. */
uint32_t reset_domain_count;
@@ -61,6 +64,12 @@ struct res_perms_ctx {
* memory.
*/
struct mod_res_agent_permission *agent_permissions;
+
+ /*!
+ * The list of domain devices in the system. If this is not set then setting
+ * device permissions for an agent is not supported.
+ */
+ struct mod_res_device *domain_devices;
};
static struct res_perms_ctx res_perms_ctx;
@@ -649,10 +658,45 @@ static enum mod_res_perms_permissions agent_resource_permissions(
return MOD_RES_PERMS_ACCESS_ALLOWED;
}
+/*
+ * Set the permissions for an agent:device.
+ */
+static int mod_res_agent_set_device_permission(
+ uint32_t agent_id,
+ uint32_t device_id,
+ uint32_t flags)
+{
+ return FWK_SUCCESS;
+}
+
+/*
+ * Set the permissions for an agent:device:protocol.
+ */
+static int mod_res_agent_set_device_protocol_permission(
+ uint32_t agent_id,
+ uint32_t device_id,
+ uint32_t protocol_id,
+ uint32_t flags)
+{
+ return FWK_SUCCESS;
+}
+
+/*
+ * Reset the permissions for an agent to the default configuration.
+ */
+static int mod_res_agent_reset_config(uint32_t agent_id, uint32_t flags)
+{
+ return FWK_SUCCESS;
+}
+
static const struct mod_res_permissions_api res_perms_api = {
.agent_has_protocol_permission = agent_protocol_permissions,
.agent_has_message_permission = agent_message_permissions,
.agent_has_resource_permission = agent_resource_permissions,
+ .agent_set_device_permission = mod_res_agent_set_device_permission,
+ .agent_set_device_protocol_permission =
+ mod_res_agent_set_device_protocol_permission,
+ .agent_reset_config = mod_res_agent_reset_config,
};
/*
@@ -691,9 +735,12 @@ static int mod_res_perms_resources_init(
res_perms_ctx.sensor_count = config->sensor_count;
res_perms_ctx.pd_count = config->pd_count;
res_perms_ctx.perf_count = config->perf_count;
+ res_perms_ctx.device_count = config->device_count;
#ifdef BUILD_HAS_SCMI_RESET
res_perms_ctx.reset_domain_count = config->reset_domain_count;
#endif
+ res_perms_ctx.domain_devices =
+ (struct mod_res_device *)config->domain_devices;
}
return FWK_SUCCESS;