From 05c7451400f36bcca05ee1c7ce69fbf3849f2cbf Mon Sep 17 00:00:00 2001 From: Daniel Fu Date: Wed, 24 Jan 2018 15:42:41 +0800 Subject: hdcp: fix tlk build failure hdcp is a common driver for different chips or kernel versions. When only enable tlk on t21x but not on t18x, there will be build fallures as follow: drivers/built-in.o: In function `get_srm_signature': kernel/nvidia/drivers/video/tegra/dc/hdmihdcp.c:824: undefined reference to `te_is_secos_dev_enabled' /kernel/nvidia/drivers/video/tegra/dc/hdmihdcp.c:825: undefined reference to `te_launch_trusted_oper_tlk' drivers/built-in.o: In function `tsec_hdcp_authentication': kernel/nvidia/drivers/video/tegra/dc/hdmihdcp.c:1217: undefined reference to `te_is_secos_dev_enabled' kernel/nvidia/drivers/video/tegra/dc/hdmihdcp.c:1218: undefined reference to `te_open_trusted_session_tlk' kernel/nvidia/drivers/video/tegra/dc/hdmihdcp.c:1398: undefined reference to `te_is_secos_dev_enabled' kernel/nvidia/drivers/video/tegra/dc/hdmihdcp.c:1400: undefined reference to `te_close_trusted_session_tlk' make[2]: *** [vmlinux] Error 1 make[2]: Leaving directory `out/target/product/t186_int/obj/KERNEL/kernel-4.4' make[1]: *** [sub-make] Error 2 Fix the build failure above. Bug 200381472 Change-Id: Ic892a1331ded47320e6c8fab8ab2186539dc68ce Signed-off-by: Daniel Fu Reviewed-on: https://git-master.nvidia.com/r/1645119 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/video/tegra/dc/hdmihdcp.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/video/tegra/dc/hdmihdcp.c b/drivers/video/tegra/dc/hdmihdcp.c index e90ee640f..4138e45db 100644 --- a/drivers/video/tegra/dc/hdmihdcp.c +++ b/drivers/video/tegra/dc/hdmihdcp.c @@ -124,8 +124,10 @@ static u8 g_seq_num_m_retries; static u8 g_fallback; void __iomem *g_misc_base; +#ifdef CONFIG_TRUSTED_LITTLE_KERNEL uint32_t hdcp_uuid[4] = HDCP_SERVICE_UUID; static uint32_t session_id; +#endif static struct tegra_dc *tegra_dc_hdmi_get_dc(struct tegra_hdmi *hdmi) { @@ -822,12 +824,18 @@ static int get_srm_signature(struct hdcp_context_t *hdcp_context, /* pass the nonce to hdcp TA and get the signature back */ memcpy(pkt, nonce, HDCP_NONCE_SIZE); + +#ifdef CONFIG_TRUSTED_LITTLE_KERNEL if (te_is_secos_dev_enabled()) err = te_launch_trusted_oper_tlk(pkt, PKT_SIZE, session_id, hdcp_uuid, HDCP_CMD_GEN_CMAC, sizeof(hdcp_uuid)); else err = te_launch_trusted_oper(pkt, PKT_SIZE, HDCP_CMD_GEN_CMAC, ta_ctx); +#else + err = te_launch_trusted_oper(pkt, PKT_SIZE, HDCP_CMD_GEN_CMAC, ta_ctx); +#endif + if (err) nvhdcp_err("te launch operation failed with error %d\n", err); return err; @@ -1214,6 +1222,8 @@ static int tsec_hdcp_authentication(struct tegra_nvhdcp *nvhdcp, &hdcp_context->msg.rxcaps_capmask); if (err) goto exit; + +#ifdef CONFIG_TRUSTED_LITTLE_KERNEL /* differentiate between TLK and trusty */ if (te_is_secos_dev_enabled()) { err = te_open_trusted_session_tlk(hdcp_uuid, sizeof(hdcp_uuid), @@ -1223,6 +1233,12 @@ static int tsec_hdcp_authentication(struct tegra_nvhdcp *nvhdcp, /* Open a trusted sesion with HDCP TA */ err = te_open_trusted_session(HDCP_PORT_NAME, &nvhdcp->ta_ctx); } +#else + nvhdcp->ta_ctx = NULL; + /* Open a trusted sesion with HDCP TA */ + err = te_open_trusted_session(HDCP_PORT_NAME, &nvhdcp->ta_ctx); +#endif + if (err) { nvhdcp_err("Error opening trusted session\n"); goto exit; @@ -1396,6 +1412,8 @@ exit: if (err) nvhdcp_err("HDCP authentication failed with err %d\n", err); kfree(pkt); + +#ifdef CONFIG_TRUSTED_LITTLE_KERNEL if (te_is_secos_dev_enabled()) { if (session_id) { te_close_trusted_session_tlk(session_id, hdcp_uuid, @@ -1408,6 +1426,13 @@ exit: nvhdcp->ta_ctx = NULL; } } +#else + if (nvhdcp->ta_ctx) { + te_close_trusted_session(nvhdcp->ta_ctx); + nvhdcp->ta_ctx = NULL; + } +#endif + return err; } -- cgit v1.2.2