blob: 605640c42c364cced7516adca81942af9b3a055b [file] [log] [blame]
#ifndef _GEU_INTERFACE_H_
#define _GEU_INTERFACE_H_
/******************************************************************************
*
* (C)Copyright 2022 ASR. All Rights Reserved.
*
******************************************************************************/
// FUSE life cycles
#define LIFECYCLE_CM 1
#define LIFECYCLE_DM 2
#define LIFECYCLE_SP 3
#define LIFECYCLE_RMA 4
// Fuse field sizes in bytes
//FB0
#define K_AP_CONFIG_FUSE_SIZE 10
#define K_TOP_CONFIG_FUSE_SIZE 2
#define K_MP1_FUSE_SIZE 8
#define K_OEM_UNIQUE_ID_FUSE_SIZE 8 /* MP1 */
//FB1
#define K_RKEK_FUSE_SIZE 32
//FB2
#define K_OEM_HASH_FUSE_SIZE 32
//FB3
#define K_MP0_FUSE_SIZE 8
#define K_USBID_FUSE_SIZE 4
//FB6
#define K_HWLOCK_FUSE_SIZE 2
#define K_LCS_FUSE_SIZE 2
//misc
#define K_FUSEBLOCK_SIZE 32
#define K_SHA1_SIZE 20
#define K_SHA256_SIZE 32
#define K_SHA512_SIZE 64
// Fuse field buffer sizes in bytes
// Data is always returned as a multiple of 4 bytes
#define K_AP_CONFIG_BUFFER_SIZE 12
#define K_TOP_CONFIG_BUFFER_SIZE 4
#define K_MP0_BUFFER_SIZE 8
#define K_USBID_BUFFER_SIZE 4
#define K_OEM_HASH_BUFFER_SIZE 32
#define K_RKEK_BUFFER_SIZE 32
#define K_FUSEBLOCK_BUFFER_SIZE 32
#define K_OEM_UNIQUE_ID_BUFFER_SIZE 8
#define K_PLAT_VERSION_FUSE_SIZE 4 /* TODO */
// Fuse field sizes in bytes
#define K_OEM_UID_FUSE_SIZE 8
// Fuse Block Numbers
#define K_AP_CONFIG_FUSEBLOCK 0
#define K_TOP_CONFIG_FUSEBLOCK 0
#define K_APCPMP0_FUSEBLOCK 0
#define K_SOC_CONFIG_FUSEBLOCK 0
#define K_PLAT_VERSION_FUSEBLOCK 0 /* TODO */
#define K_RKEK_FUSEBLOCK 1
#define K_OEM_FUSEBLOCK 2
#define K_USBID_FUSEBLOCK 3
#define K_LIFECYCLE_FUSEBLOCK 6
#define K_HWLOCK_FUSEBLOCK 6
#define K_HWLOCK_LCS_FUSEBLOCK 6
//several security related bits are in Block0
#define K_OEM_UID_FUSEBLOCK 3
#define K_NO_FUSEBLOCK 0xF
#define K_UNDEFINED_FUSEBLOCK K_NO_FUSEBLOCK
// Burn/Status Bit Masks/bits - This is an arbitrary internal
// status array that we use to determine which set we're burning
// and pass status internally.
#define K_AP_CONFIG_STATUS_BIT_MASK 0x00000001
#define K_TOP_CONFIG_STATUS_BIT_MASK 0x00000002
#define K_MP0_STATUS_BIT_MASK 0x00000004
#define K_APCPMP0_ECC_STATUS_BIT_MASK 0x00000008
#define K_SOFTWARE_VERSION_STATUS_BIT_MASK 0x00000010 // Reserved
#define K_RKEK_STATUS_BIT_MASK 0x00000020
#define K_OEM_KEY0_STATUS_BIT_MASK 0x00000040
#define K_OEM_UID_STATUS_BIT_MASK 0x00000800
#define K_HWLOCK_STATUS_BIT_MASK 0x00001000
#define K_USBID_STATUS_BIT_MASK 0x00004000
#define K_LIFECYCLE_CM_STATUS_BIT_MASK 0x00010000
#define K_LIFECYCLE_DM_STATUS_BIT_MASK 0x00020000
#define K_LIFECYCLE_SP_STATUS_BIT_MASK 0x00040000
#define K_LIFECYCLE_RMA_STATUS_BIT_MASK 0x00080000
#define K_LIFECYCLE_STATUS_BIT_MASK 0x00100000
// DebugStatus bits
#define K_FUSE_READY_TIMEOUT 0x10000000
#define K_MULTIPLE_BURN_COUNT 0x20000000
#define K_FUSE_BURN_TIMEOUT 0x40000000
#define K_FUSE_BURN_DONE_CLR_TIMEOUT 0x80000000
// LifeCycle/Software Version
#define K_PHYSICAL_BITS_PER_LOGICAL_BIT 3
#define K_LIFECYCLE_BITSIZE 16
#define K_MAX_LIFECYCLE_LOGICAL_BITS K_LIFECYCLE_BITSIZE/K_PHYSICAL_BITS_PER_LOGICAL_BIT
#define K_SOFTWARE_VERSION_BITSIZE 32
#define K_MAX_SOFTWARE_VERSION_LOGICAL_BITS K_SOFTWARE_VERSION_BITSIZE/K_PHYSICAL_BITS_PER_LOGICAL_BIT
// Fuse Burn Status
typedef struct GEU_FuseBurnStatus
{
UINT_T FinalBurnStatus;
UINT_T CorrectedBurnStatus;
UINT_T RawBurnStatus;
UINT_T SavedBurnRequest;
UINT_T DebugStatus;
}GEU_FuseBurnStatus_t;
#define TRUSTBOOT_BURN_EN 0x00000001
#define DISROMLOG_BURN_EN 0x00000002
#define CLOSEJTAG_BURN_EN 0x00000004
#define DISESCAPE_BURN_EN 0x00000008
#define CLOSEUSBD_BURN_EN 0x00000010
#define LIFECYLE_CM_BURN_EN 0x00001000
#define LIFECYLE_DM_BURN_EN 0x00002000
#define LIFECYLE_SP_BURN_EN 0x00004000
#define LIFECYLE_RMA_BURN_EN 0x00008000
#define BANKHWLOCK_BURN_EN 0xFFFF0000
UINT_T GEU_SetActiveFuseBlock(UINT_T n);
UINT_T GEU_ReadActiveFuseBlockNumber(void);
UINT_T GEU_GenerateRandomNumber (UINT_T Seed);
UINT_T GEU_ReadApConfigFuseBits(UINT_T* pBuffer, UINT_T Size);
UINT_T GEU_ReadCpConfigFuseBits(UINT_T* pBuffer, UINT_T Size);
UINT_T GEU_ReadUsbIdFuseBits(UINT_T* pBuffer, UINT_T Size);
UINT_T GEU_ReadOemHashKeyFuseBits(UINT_T* pBuffer, UINT_T Size);
UINT_T GEU_ReadLifeCycle(void);
UINT_T GEU_SetupApConfigFuseBits(UINT_T* pBuffer, UINT_T Size);
UINT_T GEU_SetupTopConfigFuseBits(UINT_T* pBuffer, UINT_T Size);
UINT_T GEU_SetupUsbIdFuseBits(UINT_T* pBuffer, UINT_T Size);
UINT_T GEU_SetupOemHashKeyFuseBits(UINT_T* pBuffer, UINT_T Size);
UINT_T GEU_SetupRkekFuseBits(UINT_T* pBuffer, UINT_T Size);
UINT_T GEU_SetupSoftwareVersionFuseBits(UINT_T value);
UINT_T GEU_SetupLifeCycleFuseBits(UINT_T* pBuffer, UINT_T Size);
UINT_T GEU_BurnFuseBlock_SocConfig(struct GEU_FuseBurnStatus * pFuseBurnStatus);
UINT_T GEU_BurnFuseBlock_OemHashKey(struct GEU_FuseBurnStatus * pUserFuseBurnStatus);
UINT_T GEU_BurnFuseBlock_Rkek(struct GEU_FuseBurnStatus * pUserFuseBurnStatus);
UINT_T GEU_BurnFuseBlock_SoftwareVersion(struct GEU_FuseBurnStatus * pUserFuseBurnStatus);
UINT_T GEU_ReadFuseBlockLockState(UINT_T* pBuffer);
UINT_T GEU_ReadRegister(UINT_T registerAddress, UINT_T * pBuffer);
UINT_T GEU_WriteRegister(UINT_T registerAddress, UINT_T value);
UINT_T GEU_EnableFuseBurnPower(void);
UINT_T GEU_ReadOemUidFuseBits(UINT_T* pBuffer, UINT_T Size);
UINT_T GEU_SetupUidFuseBits(UINT_T* pBuffer, UINT_T Size);
UINT_T GEU_BurnFuseBlock_OemUid (struct GEU_FuseBurnStatus* pUserFuseBurnStatus);
#endif //_GEU_INTERFACE_H_