Commit 0de655ca authored by Ramalingam C's avatar Ramalingam C Committed by Daniel Vetter

drm: generic fn converting be24 to cpu and vice versa

Existing functions for converting a 3bytes(be24) of big endian value
into u32 of little endian and vice versa are renamed as

s/drm_hdcp2_seq_num_to_u32/drm_hdcp_be24_to_cpu
s/drm_hdcp2_u32_to_seq_num/drm_hdcp_cpu_to_be24
Signed-off-by: default avatarRamalingam C <ramalingam.c@intel.com>
Suggested-by: default avatarDaniel Vetter <daniel@ffwll.ch>
cc: Tomas Winkler <tomas.winkler@intel.com>
Acked-by: default avatarDave Airlie <airlied@gmail.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190507162745.25600-4-ramalingam.c@intel.com
parent 43318c0a
...@@ -1305,7 +1305,7 @@ int hdcp2_propagate_stream_management_info(struct intel_connector *connector) ...@@ -1305,7 +1305,7 @@ int hdcp2_propagate_stream_management_info(struct intel_connector *connector)
/* Prepare RepeaterAuth_Stream_Manage msg */ /* Prepare RepeaterAuth_Stream_Manage msg */
msgs.stream_manage.msg_id = HDCP_2_2_REP_STREAM_MANAGE; msgs.stream_manage.msg_id = HDCP_2_2_REP_STREAM_MANAGE;
drm_hdcp2_u32_to_seq_num(msgs.stream_manage.seq_num_m, hdcp->seq_num_m); drm_hdcp_cpu_to_be24(msgs.stream_manage.seq_num_m, hdcp->seq_num_m);
/* K no of streams is fixed as 1. Stored as big-endian. */ /* K no of streams is fixed as 1. Stored as big-endian. */
msgs.stream_manage.k = cpu_to_be16(1); msgs.stream_manage.k = cpu_to_be16(1);
...@@ -1370,7 +1370,8 @@ int hdcp2_authenticate_repeater_topology(struct intel_connector *connector) ...@@ -1370,7 +1370,8 @@ int hdcp2_authenticate_repeater_topology(struct intel_connector *connector)
} }
/* Converting and Storing the seq_num_v to local variable as DWORD */ /* Converting and Storing the seq_num_v to local variable as DWORD */
seq_num_v = drm_hdcp2_seq_num_to_u32(msgs.recvid_list.seq_num_v); seq_num_v =
drm_hdcp_be24_to_cpu((const u8 *)msgs.recvid_list.seq_num_v);
if (seq_num_v < hdcp->seq_num_v) { if (seq_num_v < hdcp->seq_num_v) {
/* Roll over of the seq_num_v from repeater. Reauthenticate. */ /* Roll over of the seq_num_v from repeater. Reauthenticate. */
......
...@@ -576,7 +576,7 @@ static int mei_hdcp_verify_mprime(struct device *dev, ...@@ -576,7 +576,7 @@ static int mei_hdcp_verify_mprime(struct device *dev,
memcpy(verify_mprime_in.m_prime, stream_ready->m_prime, memcpy(verify_mprime_in.m_prime, stream_ready->m_prime,
HDCP_2_2_MPRIME_LEN); HDCP_2_2_MPRIME_LEN);
drm_hdcp2_u32_to_seq_num(verify_mprime_in.seq_num_m, data->seq_num_m); drm_hdcp_cpu_to_be24(verify_mprime_in.seq_num_m, data->seq_num_m);
memcpy(verify_mprime_in.streams, data->streams, memcpy(verify_mprime_in.streams, data->streams,
(data->k * sizeof(struct hdcp2_streamid_type))); (data->k * sizeof(struct hdcp2_streamid_type)));
......
...@@ -252,13 +252,13 @@ struct hdcp2_rep_stream_ready { ...@@ -252,13 +252,13 @@ struct hdcp2_rep_stream_ready {
* host format and back * host format and back
*/ */
static inline static inline
u32 drm_hdcp2_seq_num_to_u32(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN]) u32 drm_hdcp_be24_to_cpu(const u8 seq_num[HDCP_2_2_SEQ_NUM_LEN])
{ {
return (u32)(seq_num[2] | seq_num[1] << 8 | seq_num[0] << 16); return (u32)(seq_num[2] | seq_num[1] << 8 | seq_num[0] << 16);
} }
static inline static inline
void drm_hdcp2_u32_to_seq_num(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN], u32 val) void drm_hdcp_cpu_to_be24(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN], u32 val)
{ {
seq_num[0] = val >> 16; seq_num[0] = val >> 16;
seq_num[1] = val >> 8; seq_num[1] = val >> 8;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment