/*----------------------------------------------------------------------------*
 * No Warranty                                                                *
 * Except as may be otherwise agreed to in writing, no warranties of any      *
 * kind, whether express or implied, are given by MTK with respect to any MTK *
 * Deliverables or any use thereof, and MTK Deliverables are provided on an   *
 * "AS IS" basis.  MTK hereby expressly disclaims all such warranties,        *
 * including any implied warranties of merchantability, non-infringement and  *
 * fitness for a particular purpose and any warranties arising out of course  *
 * of performance, course of dealing or usage of trade.  Parties further      *
 * acknowledge that Company may, either presently and/or in the future,       *
 * instruct MTK to assist it in the development and the implementation, in    *
 * accordance with Company's designs, of certain softwares relating to        *
 * Company's product(s) (the "Services").  Except as may be otherwise agreed  *
 * to in writing, no warranties of any kind, whether express or implied, are  *
 * given by MTK with respect to the Services provided, and the Services are   *
 * provided on an "AS IS" basis.  Company further acknowledges that the       *
 * Services may contain errors, that testing is important and Company is      *
 * solely responsible for fully testing the Services and/or derivatives       *
 * thereof before they are used, sublicensed or distributed.  Should there be *
 * any third party action brought against MTK, arising out of or relating to  *
 * the Services, Company agree to fully indemnify and hold MTK harmless.      *
 * If the parties mutually agree to enter into or continue a business         *
 * relationship or other arrangement, the terms and conditions set forth      *
 * hereunder shall remain effective and, unless explicitly stated otherwise,  *
 * shall prevail in the event of a conflict in the terms in any agreements    *
 * entered into between the parties.                                          *
 *---------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------
 * Copyright (c) 2005, MediaTek Inc.
 * All rights reserved.
 *
 * Unauthorized use, practice, perform, copy, distribution, reproduction,
 * or disclosure of this information in whole or in part is prohibited.
 *-----------------------------------------------------------------------------
 *
 * $Author$
 * $Date$
 * $RCSfile: dmx.h,v $
 * $Revision$
 *
 *---------------------------------------------------------------------------*/

/** @file tz_if.h
 *  Interface of trustzone driver
 */


#ifndef TZ_IF_H
#define TZ_IF_H

//-----------------------------------------------------------------------------
// Include files
//-----------------------------------------------------------------------------
#include "x_typedef.h"
//-----------------------------------------------------------------------------
// Configurations
//-----------------------------------------------------------------------------


//-----------------------------------------------------------------------------
// Constant definitions
//-----------------------------------------------------------------------------


//-----------------------------------------------------------------------------
// Type definitions
//-----------------------------------------------------------------------------


//-----------------------------------------------------------------------------
// Macro definitions
//-----------------------------------------------------------------------------
#define TZ_CACHE_LINE_SIZE      64

#define TZ_CACHE_LINE_SIZE_MSK  (TZ_CACHE_LINE_SIZE - 1)
#define TZ_CACHE_ALIGN(x)       (((x) + TZ_CACHE_LINE_SIZE_MSK) & ~TZ_CACHE_LINE_SIZE_MSK)

//-----------------------------------------------------------------------------
// Prototype  of inter-file functions
//-----------------------------------------------------------------------------
EXTERN BOOL TZ_IsTrustzoneEnable(void);

#if defined(CC_TRUSTZONE_SUPPORT) || defined(CC_TRUSTZONE_64_SUPPORT)
EXTERN void TZ_NWD_BufferStart(UPTR u4Addr, UINT32 u4Size);
EXTERN void TZ_NWD_BufferEnd(UPTR u4Addr, UINT32 u4Size);
#else
#define TZ_NWD_BufferStart(u4Addr, u4Size)
#define TZ_NWD_BufferEnd(u4Addr, u4Size)
#endif
EXTERN BOOL TZ_SWDMX_MpgParsingPts(void* ptDmxPesMsg);
EXTERN BOOL TZ_SWDMX_DecryptContent(void* pvDmxMmData);
EXTERN BOOL TZ_SWDMX_FreeDecryptBuf(void);
EXTERN BOOL TZ_DMX_GetRPUData(UINT32 u4Addr, UINT32 u4BufSize, UINT32 *pu4RPUSize,UINT32 eVideoType);
EXTERN BOOL TZ_DMX_Init(void);
EXTERN BOOL TZ_DMX_LoadIMEM(BOOL bAlpSupport);
EXTERN BOOL TZ_DMX_SetMMKey(UINT32 u4Addr, UINT32 u4Val);
EXTERN BOOL TZ_DMX_GetPicHeader(UINT32 u4Addr, UINT32 u4BufStart, UINT32 u4BufEnd, UINT8 *pu1Buf, UINT32 u4Size);
EXTERN BOOL TZ_DMX_GetPicInfo(void *prData, UINT32 u4Size);
EXTERN BOOL TZ_DMX_SetUpRPUBuf(UINT8 u1TsIdx);
EXTERN BOOL TZ_DMX_GetSecureVfifo(UINT32 *pu4Addr, UINT32 *pu4Size);
EXTERN BOOL TZ_DMX_GetSecureVfifo2(UINT32 *pu4Addr, UINT32 *pu4Size);
#if defined(CC_SUPPORT_VENC_SECURE)
EXTERN BOOL TZ_VENC_GetSecureVenc(UINT32 *pu4Addr, UINT32 *pu4Size);
EXTERN BOOL TZ_VENC_GetSecureMuxer(UINT32 *pu4Addr, UINT32 *pu4Size);
EXTERN BOOL TZ_VENC_GetSecurePvr(UINT32 *pu4Addr, UINT32 *pu4Size);
#endif
EXTERN BOOL TZ_DMX_ReloadSecureKey(void *prKeyInfo, UINT32 u4Size);
EXTERN BOOL TZ_DMX_FreeSecureKeyIv(UINT8 u1Pidx);
EXTERN BOOL TZ_DMX_SetCryptoKey(void *prKeyInfo, UINT32 u4Size);
EXTERN BOOL TZ_FVR_SetCryptoKey(void *prKeyInfo, UINT32 u4Size);
EXTERN BOOL TZ_DMX_SetMMSecurity(void *prKeyInfo, UINT32 u4Size);
EXTERN BOOL TZ_DMX_TS130_Init(void);
EXTERN BOOL TZ_DMX_TS130_PacketHandler(void *prData, UINT32 u4Size);
EXTERN BOOL TZ_DMX_TS130_SetPidArray(UINT16 u2Pid);
EXTERN BOOL TZ_DMX_TS130_RequestReset(UINT8 u1TsIdx);

EXTERN BOOL TZ_DMX_MalinVODKey_Store(UINT8 u1KeyIdx, UINT64 u8Pos);
EXTERN BOOL TZ_DMX_MalinVODKey_Restore(UINT8 u1KeyIdx, UINT64 *u8Pos);

EXTERN BOOL TZ_GCPU_Hw_CmdRun(void *prKernParam, UINT32 u4ParamSize);
EXTERN BOOL TZ_GCPU_Hw_CmdReturn(void *prKernParam, UINT32 u4ParamSize);
EXTERN BOOL TZ_GCPU_EnableIOMMU(void *prKernParam, UINT32 u4ParamSize);
EXTERN BOOL TZ_GCPU_DisableIOMMU(void);
EXTERN BOOL TZ_GCPU_ISR_ClearIRQ(void);
EXTERN BOOL TZ_GCPU_ClearIRQ(void);
EXTERN BOOL TZ_GCPU_ISR_ClearIommuIRQ(void);
EXTERN BOOL TZ_GCPU_ClearIommuIRQ(void);
EXTERN BOOL TZ_GCPU_Hw_SetSlot(void *prKernParam, UINT32 u4ParamSize);
EXTERN BOOL TZ_GCPU_Hw_Reset(void *prKernParam, UINT32 u4ParamSize);
EXTERN BOOL TZ_GCPU_IrqHandle(void *prKernParam, UINT32 u4ParamSize);
EXTERN BOOL TZ_GCPU_IOMMU_IrqHandle(void *prKernParam, UINT32 u4ParamSize);
EXTERN BOOL TZ_GCPU_GetRomCodeChecksum(void *prKernParam, UINT32 u4ParamSize);
EXTERN BOOL TZ_GCPU_Hw_RestoreSecureKeys(void);

#if (defined(CC_MT5893)||defined(CC_MT5895)) && defined(CC_TRUSTZONE_SUPPORT)
EXTERN void TZ_smi_bus_enable(void);
EXTERN void TZ_smi_bus_restore(void);
EXTERN void TZ_smi_BWChangeByScene(UINT32 u4SCEN);
EXTERN void TZ_smi_ctrl_larb_mmu(UINT32 larb_id,UINT32 port_id,UINT32 enable);
EXTERN void TZ_SMI_LarbInit(void);
EXTERN void TZ_SMI_pm_resume(void);
EXTERN void TZ_smi_get_register(UINT32 larbid,UINT32 u4Offset,UINT32 *pu4Val);
EXTERN void TZ_smi_set_OSTDL(UINT32 larbid, UINT32 port, UINT32 u4Val);
EXTERN void TZ_smi_get_OSTDL(UINT32 larbid, UINT32 port, UINT32 *pu4Val);
EXTERN void TZ_smi_get_OSTD_MON(UINT32 larbid, UINT32 port, UINT32 *pu4Val);
#if defined(CC_MT5893)
EXTERN void TZ_SMI_BW_measure(char cLarbID,UINT32 cMonitorNum,UINT32 u4Delayms,UINT32 *pu4Val1,UINT32 *pu4Val2,UINT32 *pu4Val3,UINT32 *pu4Val4);
#else //mt5895
EXTERN void TZ_SMI_BW_measure(char cLarbID,char cMonitorNum,UINT32 u4Delayms,UINT32 *pu4Val);
#endif
EXTERN void TZ_smi_ctrl_larb_sectrans(UINT32 larb_id,UINT32 port_id,UINT32 enable);
#endif
EXTERN BOOL TZ_BIM_GetRomBytes(UINT32 u4Offset, UINT8 *pu1Buf, UINT32 u4Size);
/*
EXTERN BOOL TZ_DRM_Divx_GetHwSecretKey0(UINT8 *pu1Buf);
EXTERN BOOL TZ_DRM_Divx_GetHwSecretKey1(UINT8 *pu1Buf);
*/
EXTERN BOOL TZ_BIM_GetSecureID(UINT8 *pu1Buf, UINT32 u4Size);
EXTERN void TZ_DisableLog(void);

EXTERN void TZ_RunST(void);
EXTERN void TZ_RunUT(UINT32 u4Count);
EXTERN void TZ_EnableDebug(UINT32 u4Enable,UINT32 sec_start,UINT32 sec_end);
EXTERN BOOL TZ_HEAP_CHECK(UINT32 enable);

EXTERN BOOL TZ_IO_WRITE32(UINT32 u4Base, UINT32 u4Offset, UINT32 u4Val);
EXTERN BOOL TZ_IO_WRITE16(UINT32 u4Base, UINT32 u4Offset, UINT16 u2Val);
EXTERN BOOL TZ_IO_WRITE8(UINT32 u4Base, UINT32 u4Offset, UINT8 u1Val);
EXTERN BOOL TZ_IO_READ32(UINT32 u4Base, UINT32 u4Offset, UINT32 *pu4Val);
EXTERN BOOL TZ_IO_READ16(UINT32 u4Base, UINT32 u4Offset, UINT16 *pu2Val);
EXTERN BOOL TZ_IO_READ8(UINT32 u4Base, UINT32 u4Offset, UINT8 *pu1Val);

EXTERN BOOL TZ_SKB_GetInstance(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_Release(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_GetInfo(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_GetProertiesSize(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_GetProertiesData(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_DataFromWrapped(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_DataFromExported(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_CreateTransform(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_CreateCipher(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_SecureData_Release(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_SecureDataGetInfo(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_SecureData_Export(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_SecureData_Derive(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_Transform_Release(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_Transform_AddBytes(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_Transform_AddSecureData(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_Transform_GetOutput(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_Cipher_ProcessBuffer(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_SKB_Cipher_Release(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_DRM_TZ_SetSecretDataType(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_DRM_TZ_Open(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_DRM_TZ_Close(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_DRM_TZ_DecodePacketsVOD(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_DRM_TZ_LoadSecretDataType(void *prKernParam, UINT32 u4Size);

#ifdef CC_ENABLE_HDCP2
EXTERN BOOL TZ_HDCP2_SetEncKey(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_GetCertInfo(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_DecryptRSAESOAEP(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_KdKeyDerivation(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_ComputeHprime(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_ComputeLprime(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_ComputeKh(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_EncryptKmUsingKh(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_DecryptKmUsingKh(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_DecryptEKs(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_KsXorLC128(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_SetRiv_Pid(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_PresetKsLC128(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_Generate_Km(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_Generate_Ks(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_GetEncKm(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_SetEncKm(void *prKernParam, UINT32 u4Size);


EXTERN BOOL TZ_HDCP2_HMAC_SHA256(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_HDCP2_Compute_Riv_Hmac(void *prKernParam, UINT32 u4Size);

/*
for HDCP 2.2
*/


BOOL TZ_HDCP2_2_KdKeyDerivation(void *prKernParam, UINT32 u4Size);
BOOL TZ_HDCP2_2_ComputeHprime(void *prKernParam, UINT32 u4Size);
BOOL TZ_HDCP2_2_ComputeLprime(void *prKernParam, UINT32 u4Size);


/*
for hdcp align
*/

EXTERN BOOL TZ_HDCP2_SetEncKeySet(void * prKernParam,UINT32 u4Size);



/*
for HDCP TX
*/
#ifdef HDCP_DTV_NO_USE

EXTERN BOOL TZ_HDCP2_RetrvEkh_km(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_SavePairingInfo(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_CheckRxID(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_ComputeMprime(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_ComputeVprime(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_2_ComputeVprime(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_VerifySignature(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_Generate_Km_for_tx(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_ResetPairingInfo(void *prKernParam, UINT32 u4Size);

#endif

/*for android  */
EXTERN BOOL TZ_HDCP2_UseTestKey_InKernel(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP2_enable_tz_key(void *prKernParam, UINT32 u4Size);





#endif

#ifdef CC_WIDEVINE_L1_SUPPORT
#ifndef CC_WIDEVINE_TRUSTY

EXTERN BOOL TZ_OEMCrypto_Initialize(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_Terminate(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_OpenSession(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_CloseSession(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_GenerateDerivedKeys(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_GenerateNonce(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_GenerateSignature(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_LoadKeys(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_RefreshKeys(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_SelectKey(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_DecryptCENC(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_DecryptCTR(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_InstallKeybox(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_IsKeyboxValid(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_GetDeviceID(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_GetKeyData(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_GetRandom(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_WrapKeybox(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_RewrapDeviceRSAKey(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_LoadDeviceRSAKey(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_GenerateRSASignature(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_DeriveKeysFromSessionKey(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_Generic_Encrypt(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_Generic_Decrypt(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_Generic_Sign(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_Generic_Verify(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_OEMCrypto_SetEntitlementKey(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_DeriveControlWord(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_DecryptVideo(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_DecryptAudio(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_OEMCrypto_UpdateUsageTable(void *arg, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_DeactivateUsageEntry(void *arg, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_ReportUsage(void *arg, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_DeleteUsageEntry(void *arg, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_DeleteUsageTable(void *arg, UINT32 u4Size);

EXTERN BOOL TZ_OEMCrypto_GetUsageTableWriteRequest(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_VerifyWriteResponse(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_OEMCrypto_GetUsageTableReadRequest(void *arg, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_VerifyReadResponse(void *arg, UINT32 u4Size);

EXTERN BOOL TZ_OEMCrypto_GetNumberOfOpenSessions(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_CopyBuffer(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_QueryKeyControl(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_ForceDeleteUsageEntry(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_LoadTestKeybox(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_OEMCrypto_LoadTestRSAKey(void *prKernParam, UINT32 u4Size);

#endif
#endif


EXTERN BOOL TZ_SEC_BUF_OPEN_SESSION(void *prKernParam  , UINT32 u4Size);
EXTERN BOOL TZ_SEC_BUF_CLOSE_SESSION(void *prKernParam , UINT32 u4Size);
EXTERN BOOL TZ_SEC_BUF_ALLOC(void *prKernParam         , UINT32 u4Size);
EXTERN BOOL TZ_SEC_BUF_FREE(void *prKernParam          , UINT32 u4Size);
EXTERN BOOL TZ_SEC_BUF_FLUSH(void *prKernParam         , UINT32 u4Size);
EXTERN BOOL TZ_SEC_BUF_CLEAN(void *prKernParam         , UINT32 u4Size);
EXTERN BOOL TZ_SEC_BUF_FRAGMENT_ALLOC(void *prKernParam , UINT32 u4Size);
EXTERN BOOL TZ_SEC_BUF_FRAGMENT_FREE(void *prKernParam  , UINT32 u4Size);
EXTERN BOOL TZ_SEC_BUF_CPB_MOVEDATA(void *prKernParam  , UINT32 u4Size);
EXTERN BOOL TZ_SEC_BUF_CPB_GETDATA(void *prKernParam  , UINT32 u4Size);

EXTERN BOOL TZ_SVP_AddProtectRegion(UINT32 u4Start, UINT32 u4End);
EXTERN BOOL TZ_SVP_RemoveProtectRegion(UINT32 u4Start, UINT32 u4End);

EXTERN BOOL TZ_SVP_KernelProtect(UINT32 u4Start, UINT32 u4End, UINT32 u4Command);
/* SONY IPTVES */

/* sac */
EXTERN BOOL TZ_IPTVES_SAC_CONSTRUCT(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_IPTVES_SAC_DESTRUCT(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_IPTVES_SAC_MkMsg(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_IPTVES_SAC_ProcessMsg(void *prKernParam, UINT32 u4Size);




/* sdi */
EXTERN BOOL TZ_IPTVES_SDI_INIT(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_SDI_FIN(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_SDI_CleanupNVS(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_SDI_GetDeviceID(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_SDI_VerifyServiceMetaData(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_SDI_JudgeCRLUpdate(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_SDI_GetCRLDstPoint(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_SDI_SetCRL(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_SDI_CheckTrustedTime(void *prKernParam, UINT32 u4Size);



/* ecm */
EXTERN BOOL TZ_IPTVES_ECM_ExtractScrambleKey(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_ECM_GetScrambleKey(void *prKernParam, UINT32 u4Size);



/* drm */
EXTERN BOOL TZ_IPTVES_DRM_ExtractContentKey(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_DRM_DelContentKey(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_DRM_DelUncommittedKey(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_DRM_GetKeyInfo(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_DRM_GetKeyNum(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_DRM_GetKeyRefList(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_IPTVES_DRM_GetContentKey(void *prKernParam, UINT32 u4Size);



/* nvs */
EXTERN BOOL TZ_IPTVES_NVS_MEM_Init(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_IPTVES_NVS_MEM_Fin(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_IPTVES_NVS_MEM_GetRWLen(void *prKernParam, UINT32 u4Size);



/* time */
EXTERN BOOL TZ_IPTVES_TIME_SetTrustedTime(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_IPTVES_TIME_GetTrustedTime(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_IPTVES_TIME_Cleanup(void *prKernParam, UINT32 u4Size);

/* rend */
EXTERN BOOL TZ_IPTVES_REND_Extract(void *prKernParam, UINT32 u4Size);

#if defined(CC_TRUSTZONE_SUPPORT) && defined(CC_TVP_SUPPORT)
BOOL TZ_VDEC_FB_Operation(VOID* prTzFbOp, UCHAR ucOperation);
BOOL TZ_VDEC_Check_RealD(VOID *prDisp);
#endif

#if defined(CC_TRUSTZONE_SUPPORT) && defined(CC_SVP_SUPPORT)
BOOL TZ_VP9_SUPER_FRAME_PARSE(UINT64 u4Start, UINT32 u4Size, UINT32* pu4Sizes);
BOOL TZ_VDEC_HEADER_PARSE(VOID* prInOut);
BOOL TZ_VDEC_SVP_CALL(VOID *pvData, UINT32 u4Size);
#endif

#if defined(CC_TVP_SUPPORT)
BOOL TZ_FBM_Initialization(void *prKernParam  , UINT32 u4Size);
#endif

EXTERN BOOL TZ_TEE_Common_Operate(UINT32 ui4Command, void *ptCommonArg, UINT32 u4Size);
EXTERN BOOL TZ_HDMI2_0_HDCP2_2LoadKey(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDMI2_0_HDCP2_2CheckKeyValid(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDMI2_0_HDCP2_GetSecureKey(void *prKernParam, UINT32 u4Size);
//HDCP2.2 SW
EXTERN BOOL TZ_HDCP22_SW_SET_SKE_PASS_RX(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP22_SW_GET_RX_CERT(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP22_SW_SET_INIT_MODULE_RX(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP22_SW_SET_MASTER_KEY_NO_STORED_RX(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP22_SW_SET_Integrity_Key(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP22_SW_GET_COMPUTE_H(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP22_SW_SET_COMPUTE_KH(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP22_SW_GET_Encrypt_Kh_Km(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP22_SW_SET_Decrypt_Kh_Km(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP22_SW_GET_COMPUTE_L(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP22_SW_SET_Compute_Ks(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP22_SW_SET_Compute_KsXorLC128(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP22_SW_SET_Process_Cipher_Rx(void *prKernParam, UINT32 u4Size);
EXTERN BOOL TZ_HDCP22_SW_SET_TEST_REGISTER(UINT8 u1Enable);

EXTERN BOOL TZ_HDMI2_0_Sel_MainVideo(UINT8 u1HdmiPort);
EXTERN BOOL TZ_HDMI2_0_Sel_SubVideo(UINT8 u1HdmiPort);
EXTERN BOOL TZ_HDMI2_0_Sel_W2D1(UINT8 u1HdmiPort);
EXTERN BOOL TZ_HDMI2_0_Sel_W2D2(UINT8 u1HdmiPort);
EXTERN BOOL TZ_HDMI2_1_Sel_Video_LR(UINT8 u1HDMI21LRInfo);

EXTERN BOOL TZ_EEPROM_Read_Test(void);
EXTERN BOOL TZ_EEPROM_Write_Test(void);

//EXTERN BOOL TZ_VSS_Chk4KCapture(UINT8 u2OnOff,UINT8 u1SrcChk );
EXTERN BOOL TZ_VSS_Chk4KCapture(void *prKernParam , UINT32 u4Size );
EXTERN BOOL TZ_VM_OnOff(VOID *prVMParam, UINT32 u4Size);
EXTERN BOOL TZ_MOutMUX_CHG(UINT8 dec);
EXTERN BOOL TZ_SOutMUX_CHG(UINT8 dec);
EXTERN BOOL TZ_NPIP_MUX_SEL(UINT8 dec);
#if defined(CC_MT5893) || defined(CC_MT5895)
EXTERN BOOL TZ_Mon_Out_Sel(UINT8 mon_out_sel, UINT32 u4Size);
EXTERN BOOL TZ_Vss_Sel(UINT8 vss_sel, UINT32 u4Size);
#endif
#if defined(CC_MT5895)
EXTERN BOOL TZ_Mon_Out2_Sel(UINT8 mon_out_sel, UINT32 u4Size);
EXTERN BOOL TZ_Vss2_Sel(UINT8 vss_sel, UINT32 u4Size);
#endif
/*CastTV Authenication*/
BOOL TZ_CastTV_Auth_SignHash(void *prKernParam, UINT32 u4Size);

EXTERN BOOL TZ_SMC_SetTempValues(void *prTempValues, UINT32 u4Size);
EXTERN BOOL TZ_SMC_GetTempValues(void *prTempValues, UINT32 u4Size);
EXTERN BOOL TZ_SMC_GenerateKCL(void *prKclParam, UINT32 u4Size);
EXTERN BOOL TZ_SMC_GenerateKS(void *prKclParam, UINT32 u4Size);

#ifdef CC_TRUSTY_SUPPORT
EXTERN BOOL TZ_TRUSTY_Common_Operate(UINT32 ui4Command, void *ptCommonArg, UINT32 u4Size);
#endif  // CC_TRUSTY_SUPPORT

BOOL TZ_DEMOD_RESET(UINT32 u4Value);

EXTERN BOOL TZ_DMX_ECP_Comm_Ctrl(void *pEcpCommCtrl, UINT32 u4Size);

#endif  // TZ_IF_H


