[PATCH 5/5] drm/amd/display: call psp set/get interfaces
Harry Wentland
hwentlan at amd.com
Wed Jan 22 19:25:24 UTC 2020
On 2020-01-16 3:29 p.m., Bhawanpreet Lakha wrote:
> Call the cmd ids for set/get srm according to the sysfs call
>
> Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha at amd.com>
> Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira at amd.com>
> ---
> .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 49 ++++++++++++++++++-
> 1 file changed, 48 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
> index 129696e997b6..913d0e1e0828 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
> @@ -71,11 +71,58 @@ lp_read_dpcd(void *handle, uint32_t address, uint8_t *data, uint32_t size)
>
> static uint8_t *psp_get_srm(struct psp_context *psp, uint32_t *srm_version, uint32_t *srm_size)
> {
> - return NULL;
> +
> + struct ta_hdcp_shared_memory *hdcp_cmd;
> +
> + if (!psp->hdcp_context.hdcp_initialized) {
> + DRM_WARN("Failed to get hdcp srm. HDCP TA is not initialized.");
> + return NULL;
> + }
> +
> + hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
> + memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
> +
> + hdcp_cmd->cmd_id = TA_HDCP_COMMAND__HDCP_GET_SRM;
> + psp_hdcp_invoke(psp, hdcp_cmd->cmd_id);
> +
> + if (hdcp_cmd->hdcp_status != TA_HDCP_STATUS__SUCCESS)
> + return NULL;
> +
> + *srm_version = hdcp_cmd->out_msg.hdcp_get_srm.srm_version;
> + *srm_size = hdcp_cmd->out_msg.hdcp_get_srm.srm_buf_size;
> +
> +
> + return hdcp_cmd->out_msg.hdcp_get_srm.srm_buf;
> }
>
> static int psp_set_srm(struct psp_context *psp, uint8_t *srm, uint32_t srm_size, uint32_t *srm_version)
> {
> +
> + struct ta_hdcp_shared_memory *hdcp_cmd;
> +
> + if (!psp->hdcp_context.hdcp_initialized) {
> + DRM_WARN("Failed to get hdcp srm. HDCP TA is not initialized.");
> + return -EINVAL;
> + }
> +
> + hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
> + memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
> +
> + memcpy(hdcp_cmd->in_msg.hdcp_set_srm.srm_buf, srm, srm_size);
> + hdcp_cmd->in_msg.hdcp_set_srm.srm_buf_size = srm_size;
> + hdcp_cmd->cmd_id = TA_HDCP_COMMAND__HDCP_SET_SRM;
> +
> + psp_hdcp_invoke(psp, hdcp_cmd->cmd_id);
> +
> + /*
> + * If the SRM version being loaded is less than or equal to the
> + * currently loaded SRM, psp will return 0xFFFF
> + */
> + if (hdcp_cmd->hdcp_status != TA_HDCP_STATUS__SUCCESS || hdcp_cmd->out_msg.hdcp_set_srm.valid_signature != 1 ||
> + hdcp_cmd->out_msg.hdcp_set_srm.srm_version == 0xFFFF)
Can we define the 0xFFFF value in this file instead of using and
documenting a magic value?
Harry
> + return -EINVAL;
> +
> + *srm_version = hdcp_cmd->out_msg.hdcp_set_srm.srm_version;
> return 0;
> }
>
>
More information about the amd-gfx
mailing list