Skip to content
This repository was archived by the owner on Aug 27, 2024. It is now read-only.

Commit 4b2c84e

Browse files
committed
[CP] update HDCP userspace driver to align kernel change
Update userspace driver with below changes: 1. drm property names 2. srm new design: srm data is stored in a fw file instead of blob property [Internal] Platforms: Gen9, Gen11 OS: Linux Feature impact: HDCP, API Resolves: N/A Related-to: VSMGWL-19253 Klocwork: PASS IP Scan: SKIP Change-Id: I4ad1e0844f707eff469d6e8f7c5834fdaebea8cb Signed-off-by: Yu Shiqiang <shiqiang.yu@intel.com>
1 parent 9ba9511 commit 4b2c84e

File tree

4 files changed

+42
-25
lines changed

4 files changed

+42
-25
lines changed

daemon/daemon.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -595,12 +595,6 @@ void HdcpDaemon::Config(SocketData& data)
595595
{
596596
HDCP_FUNCTION_ENTER;
597597

598-
if (data.Config.type != data.Config.type)
599-
{
600-
data.Status = HDCP_STATUS_ERROR_INTERNAL;
601-
return;
602-
}
603-
604598
int32_t sts = SrmConfig(data.Config.disableSrmStorage);
605599
if (SUCCESS != sts)
606600
{

daemon/portmanager.cpp

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,6 @@ int32_t PortManager::InitDrmObjects()
621621

622622
if (CONTENT_PROTECTION == prop_name ||
623623
CP_CONTENT_TYPE == prop_name ||
624-
CP_SRM == prop_name ||
625624
CP_DOWNSTREAM_INFO == prop_name)
626625
{
627626
DrmObject *drmObject = GetDrmObjectByDrmId(res->connectors[i]);
@@ -807,7 +806,7 @@ int32_t PortManager::EnablePort(
807806
{
808807
drmObject->CpTypeAtomicEnd();
809808
HDCP_ASSERTMESSAGE(
810-
"Failed to enable port with id %d, check proerty failed",
809+
"Failed to enable port with id %d, check property failed",
811810
portId);
812811
return EBUSY;
813812
}
@@ -997,22 +996,44 @@ int32_t PortManager::SendSRMData(const uint8_t *data, const uint32_t size)
997996
{
998997
HDCP_FUNCTION_ENTER;
999998

1000-
for (auto drmObject : m_DrmObjects)
999+
CHECK_PARAM_NULL(data, EINVAL);
1000+
1001+
//Write srm data into fw file
1002+
int32_t ret = -1;
1003+
size_t total = 0;
1004+
int fd = open(DISPLAY_SRM_STORAGE_FILE, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR);
1005+
if (0 > fd)
10011006
{
1002-
int32_t ret = SetPortProperty(drmObject->GetDrmId(),
1003-
drmObject->GetPropertyId(CP_SRM),
1004-
size,
1005-
data,
1006-
1);
1007-
if (SUCCESS != ret)
1007+
HDCP_ASSERTMESSAGE("Could not open file Err: %s!", strerror(errno));
1008+
return -errno;
1009+
}
1010+
do
1011+
{
1012+
ret = write(fd, data + total, size - total);
1013+
if (0 >= ret)
10081014
{
1009-
HDCP_WARNMESSAGE("Faild to send SRM Data");
1010-
return ret;
1015+
if (EINTR == errno || EAGAIN == errno)
1016+
continue;
1017+
else
1018+
break;
10111019
}
1020+
total += ret;
1021+
} while(total != size);
1022+
1023+
if (total != static_cast<size_t>(size))
1024+
{
1025+
HDCP_ASSERTMESSAGE("Failed to write srm to file. Err: %s", strerror(errno));
1026+
ret = -EIO;
1027+
}
1028+
else
1029+
{
1030+
ret = SUCCESS;
10121031
}
10131032

1014-
HDCP_FUNCTION_EXIT(SUCCESS);
1015-
return SUCCESS;
1033+
close(fd);
1034+
1035+
HDCP_FUNCTION_EXIT(ret);
1036+
return ret;
10161037
}
10171038

10181039
void PortManager::RemoveAppFromPorts(const uint32_t appId)

daemon/portmanager.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@
6262
#define CP_TYPE_1 1
6363

6464
//KMD property name
65-
#define CONTENT_PROTECTION "Content Protection"
66-
#define CP_CONTENT_TYPE "CP_Content_Type"
67-
#define CP_DOWNSTREAM_INFO "CP_Downstream_Info"
68-
#define CP_SRM "CP_SRM"
65+
#define CONTENT_PROTECTION "Content Protection"
66+
#define CP_CONTENT_TYPE "HDCP Content Type"
67+
#define CP_DOWNSTREAM_INFO "CP_Downstream_Info"
6968

7069
typedef struct _DownstreamInfo
7170
{
@@ -194,7 +193,7 @@ class PortManager
194193
uint8_t *ksvList);
195194

196195
///////////////////////////////////////////////////////////////////////////
197-
/// \brief Send the SRM Data to the topology
196+
/// \brief Store the SRM Data to fw file
198197
///
199198
/// \param[in] portId, Port Id on which to get ksv list
200199
/// \param[out] ksvCount, the number of KSVs in the topology
@@ -413,7 +412,7 @@ int32_t PortManagerGetKsvList(
413412
uint8_t *ksvList);
414413

415414
///////////////////////////////////////////////////////////////////////////////
416-
/// \brief Send SRM Data to the topology
415+
/// \brief Send SRM Data to the fw file
417416
///
418417
///////////////////////////////////////////////////////////////////////////////
419418
int32_t PortManagerSendSRMDdata(const uint8_t *data, const uint32_t size);

daemon/srm.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646

4747
#define SRM_FIRST_GEN_MAX_SIZE 5116 // From HDCP HDMI spec
4848

49+
//KMD reads SRM from this FW file then do HDCP revocation check
50+
#define DISPLAY_SRM_STORAGE_FILE "/lib/firmware/display_hdcp_srm.bin"
51+
4952
typedef struct _SrmHeader
5053
{
5154
union

0 commit comments

Comments
 (0)