xilnvm
Vitis Drivers API Documentation
XilNvm Utils APIs

Functions

u32 XNvm_AesCrcCalc (const u32 *Key)
 This function calculates CRC of AES key. More...
 
int XNvm_EfuseCheckAesKeyCrc (u32 CrcRegOffSet, u32 CrcDoneMask, u32 CrcPassMask, u32 Crc)
 This function performs the CRC check of AES key/User0 key/User1 key. More...
 
int XNvm_ZeroizeAndVerify (u8 *DataPtr, const u32 Length)
 This function is used to zeroize the memory. More...
 
u32 XNvm_EfuseReadReg (u32 BaseAddress, u32 RegOffset)
 This function reads the given register. More...
 
void XNvm_EfuseWriteReg (u32 BaseAddress, u32 RegOffset, u32 Data)
 This function writes the value into the given register. More...
 
int XNvm_EfuseLockController (void)
 This function locks the eFUSE Controller to prevent accidental writes to eFUSE controller registers. More...
 
int XNvm_EfuseUnlockController (void)
 This function unlocks the eFUSE Controller for writing to its registers. More...
 
int XNvm_EfuseSetupController (XNvm_EfuseOpMode Op, XNvm_EfuseRdMode RdMode)
 This function setups eFUSE controller for given operation and read mode. More...
 
int XNvm_EfuseResetReadMode (void)
 This function disables Margin Read mode of eFUSE controller. More...
 
int XNvm_EfuseDisableProgramming (void)
 This function disables programming mode of eFUSE controller. More...
 

Function Documentation

u32 XNvm_AesCrcCalc ( const u32 *  Key)

This function calculates CRC of AES key.

Parameters
Key- Pointer to the key for which CRC has to be calculated.
Returns
CRC of AES key.

Process each bits of 32-bit Value

Get 5-bit from Address

Return CRC value upon success

References REVERSE_POLYNOMIAL.

int XNvm_EfuseCheckAesKeyCrc ( u32  CrcRegOffSet,
u32  CrcDoneMask,
u32  CrcPassMask,
u32  Crc 
)

This function performs the CRC check of AES key/User0 key/User1 key.

Parameters
CrcRegOffSet- Register offset of respective CRC register
CrcDoneMask- Respective CRC done mask in status register
CrcPassMask- Respective CRC pass mask in status register
Crc- A 32 bit CRC value of an expected AES key.
Returns
- XST_SUCCESS - On successful CRC check.
  • XNVM_EFUSE_ERR_CRC_VERIFICATION - If AES boot key integrity check is failed.
  • XST_FAILURE - If AES boot key integrity check has not finished.
Note
For Calculating the CRC of the AES key use the XNvm_AesCrcCalc() function.

Read the WR_LOCK_REG. Unlock the controller if read as locked

Write the crc to crcregoffset of eFuse_ctrl register

Wait for crcdone

Read efuse status register. If Crc is not done return XST_FAILURE

Return XNVM_EFUSE_ERR_CRC_VERIFICATION if Crc is not Pass. Return XST_SUCCESS upon crc pass and done

Lock efuse controller

References XNVM_EFUSE_ERR_CRC_VERIFICATION, XNvm_EfuseLockController(), XNvm_EfuseReadReg(), XNvm_EfuseUnlockController(), and XNvm_EfuseWriteReg().

Referenced by XNvm_EfuseValidateAesKeyWriteReq(), XNvm_EfuseValidateDecOnlyRequest(), and XNvm_EfuseWriteUds().

int XNvm_EfuseDisableProgramming ( void  )

This function disables programming mode of eFUSE controller.

Returns
XST_SUCCESS - if eFUSE programming is disabled successfully. XST_FAILURE - if there is a failure
  • XST_SUCCESS If eFUSE programming is disabled successfully.
  • XST_FAILURE If there is a failure

Read EFUSE_CFG_REG

disable eFuse program mode by writing EFUSE_CFG_REG register

Read EFUSE_CFG_REG

Disable eFuse program mode by writing EFUSE_CFG_REG register

int XNvm_EfuseLockController ( void  )

This function locks the eFUSE Controller to prevent accidental writes to eFUSE controller registers.

Returns
- XST_SUCCESS - eFUSE controller locked.
  • XNVM_EFUSE_ERR_LOCK - Failed to lock eFUSE controller register access.

Write lock Passcode in efuse control at offset of WR_LOCK_REG

Read the WR_LOCK_REG if above write was successful. Return XNVM_EFUSE_ERR_LOCK if not success

References XNVM_EFUSE_ERR_LOCK, XNvm_EfuseReadReg(), and XNvm_EfuseWriteReg().

Referenced by XNvm_EfuseCheckAesKeyCrc(), XNvm_EfuseWrite(), and XNvm_EfuseWritePuf().

int XNvm_EfuseResetReadMode ( void  )

This function disables Margin Read mode of eFUSE controller.

Returns
XST_SUCCESS - if resetting read mode is successful. XST_FAILURE - if there is a failure
  • XST_SUCCESS If resetting read mode is successful.
  • XST_FAILURE If there is a failure

Read EFUSE_CFG_REG

Reset Read mode from margin read mode by writing the EFUSE_CFG_REG

Read EFUSE_CFG_REG register.

Reset read mode from margin read mode by writing the EFUSE_CFG_REG.

int XNvm_EfuseSetupController ( XNvm_EfuseOpMode  Op,
XNvm_EfuseRdMode  RdMode 
)

This function setups eFUSE controller for given operation and read mode.

Parameters
Op- Operation to be performed read/program(write).
RdMode- Read mode for eFUSE read operation.
Returns
- XST_SUCCESS - eFUSE controller setup for given op.
  • XNVM_EFUSE_ERR_UNLOCK - Failed to unlock eFUSE controller register access.
Parameters
Op- Operation to be performed read/program(write).
RdMode- Read mode for eFUSE read operation.
Returns
  • XST_SUCCESS eFUSE controller setup for given op.
  • XNVM_EFUSE_ERR_UNLOCK Failed to unlock eFUSE controller register access.
  • XST_FAILURE If eFUSE controller is not unlocked
  • XNVM_EFUSE_ERR_PGM_TBIT_PATTERN If TBITS pattern is not matched with the expected value.

Unlock eFuse controller to write into eFuse registers

Set Read mode

Initialize eFuse Timers

Enable programming of Xilinx reserved eFuse

Check for T bits enabled

Unlock eFuse controller to write into eFuse registers.

Disable power down mode and set reference clock to eFuse.

Set read mode.

Initialize eFuse Timers.

Enable programming of Xilinx reserved eFuse.

Check for T bits for the expected pattern.

int XNvm_EfuseUnlockController ( void  )

This function unlocks the eFUSE Controller for writing to its registers.

Returns
XST_SUCCESS - eFUSE controller locked. XNVM_EFUSE_ERR_UNLOCK - Failed to unlock eFUSE controller register access.

Write unlock Passcode in efuse control at offset of WR_LOCK_REG

Read the WR_LOCK_REG if above write was successful. Return XNVM_EFUSE_ERR_UNLOCK if not success

References XNVM_EFUSE_ERR_UNLOCK, XNvm_EfuseReadReg(), and XNvm_EfuseWriteReg().

Referenced by XNvm_EfuseCheckAesKeyCrc(), and XNvm_EfuseSetupController().

void XNvm_EfuseWriteReg ( u32  BaseAddress,
u32  RegOffset,
u32  Data 
)

This function writes the value into the given register.

Parameters
BaseAddressis the eFuse controller base address.
RegOffsetis the register offset from the base address.
Datais the 32-bit value to be written to the register.

Referenced by XNvm_EfuseCacheReload(), XNvm_EfuseCheckAesKeyCrc(), XNvm_EfuseDisablePowerDown(), XNvm_EfuseEnableProgramming(), XNvm_EfuseInitTimers(), XNvm_EfuseLockController(), XNvm_EfuseSetRefClk(), XNvm_EfuseSetupController(), and XNvm_EfuseUnlockController().

int XNvm_ZeroizeAndVerify ( u8 *  DataPtr,
const u32  Length 
)

This function is used to zeroize the memory.

Parameters
DataPtrPointer to the memory which need to be zeroized.
LengthLength of the data in bytes.
Returns
  • XST_SUCCESS: If Zeroization is successful.
  • XST_FAILURE: If Zeroization is not successful.

Clear the decrypted data

Read it back to verify

Referenced by XNvm_EfuseReadIv(), and XNvm_EfuseReadPuf().