Velocity Userspace
Classes | Functions
Manufacturing Functions

Manufacturing-related API functions. More...

Classes

struct  cfg_stmfd
 
struct  get_cfgs_reply
 

Functions

static int switchtec_mfg_cmd (struct switchtec_dev *dev, uint32_t cmd, const void *payload, size_t payload_len, void *resp, size_t resp_len)
 Execute a manufacturing command on the Switchtec device. More...
 
static void get_i2c_operands (enum switchtec_gen gen, uint32_t *addr_shift, uint32_t *map_shift, uint32_t *map_mask)
 Get I2C operands based on the Switchtec generation. More...
 
static int get_configs (struct switchtec_dev *dev, struct get_cfgs_reply *cfgs, int *otp_valid)
 Retrieve configuration settings from the device. More...
 
int switchtec_security_spi_avail_rate_get (struct switchtec_dev *dev, struct switchtec_security_spi_avail_rate *rates)
 Get the available SPI rates for the Switchtec device. More...
 
static void parse_otp_settings (struct switchtec_security_cfg_otp_region *otp, uint32_t flags)
 Parse OTP settings from flags. More...
 
int switchtec_security_config_get (struct switchtec_dev *dev, struct switchtec_security_cfg_state *state)
 Get secure boot configurations. More...
 
int switchtec_mailbox_to_file (struct switchtec_dev *dev, int fd)
 Retrieve mailbox entries. More...
 
static int convert_spi_clk_rate (float clk_float, int hi_rate)
 Converts SPI clock rate from float to an integer index. More...
 
int switchtec_security_config_set (struct switchtec_dev *dev, struct switchtec_security_cfg_set *setting)
 Set secure settings. More...
 
int switchtec_otp_sjtag_mode_set (struct switchtec_dev *dev, uint8_t sjtag_mode)
 Set the SJTAG mode for the Switchtec device. More...
 
int switchtec_sjtag_hr_send (struct switchtec_dev *dev, uint8_t *sjtag_hr)
 Send SJTAG host response to the device. More...
 
int switchtec_otp_sjtag_uuid_set (struct switchtec_dev *dev, uint8_t *sjtag_uuid)
 Set the SJTAG UUID for a Switchtec device. More...
 
int switchtec_otp_sjtag_key_set (struct switchtec_dev *dev, uint8_t *sjtag_key)
 Set the SJTAG key in the OTP memory of the Switchtec device. More...
 
int switchtec_otp_config_prog (struct switchtec_dev *dev, uint16_t config_len, uint8_t *config_data, bool is_firmware_halt)
 Programs the OTP configuration on the Switchtec device. More...
 
int switchtec_otp_config_read (struct switchtec_dev *dev, uint16_t config_start_address, int32_t config_length, int out_fd)
 Reads OTP configuration data from the device. More...
 
int switchtec_otp_sjtag_key_verify (struct switchtec_dev *dev, uint8_t *sjtag_key, uint8_t *is_verified)
 Verify the SJTAG key in the OTP memory. More...
 
int switchtec_otp_sjtag_key_lock (struct switchtec_dev *dev)
 Locks the SJTAG key on the specified Switchtec device. More...
 
int switchtec_chip_serial_num_prog (struct switchtec_dev *dev, uint32_t chip_serial_num)
 Program the chip serial number for a Switchtec device. More...
 
int switchtec_otp_sku_info_set (struct switchtec_dev *dev, struct otp_sku_info_set *sku_info_set_str)
 Set the SKU information in the OTP memory of the Switchtec device. More...
 
int switchtec_sjtag_get_uuid_idcode (struct switchtec_dev *dev, uint8_t *sjtag_uuid_ptr, uint8_t *sjtag_idcode)
 Retrieve the UUID and ID code from the switchtec device. More...
 
int switchtec_sjtag_get_nonce (struct switchtec_dev *dev, struct sjtag_nonce *sjtag_nonce_ptr)
 Retrieve the SJTAG nonce from the device. More...
 
int switchtec_sjtag_status_get (struct switchtec_dev *dev, struct sjtag_status_get *sjtag_sts_get)
 Get the SJTAG status from the switchtec device. More...
 
void sjtag_encode_cmd_header (uint8_t *cmd_header, uint8_t cmd)
 This function generates the command header to send to the server. More...
 
int sjtag_debug_token_gen (uint8_t *idcode_ptr, uint8_t *uuid_ptr, uint8_t *suv_ptr, uint8_t *sjtag_debug_token, bool verbose)
 This Generates the Debug Token. More...
 
int switchtec_read_sjtag_debug_token_file (FILE *debug_token_file, struct sjtag_debug_token *debug_token)
 This function fetches the Debug Token from a bin file. More...
 
int switchtec_otp_regs_write_protect (struct switchtec_dev *dev, bool sku_info, bool otp_config)
 Write Protect given choice of OTP Regions. More...
 
int switchtec_otp_sku_info_get (struct switchtec_dev *dev, struct otp_sku_info_get *sku_info_get_str)
 Get SKU Information and Write Protected Status. More...
 
int switchtec_otp_self_test_policy_set (struct switchtec_dev *dev, uint8_t *self_test_policy)
 Program Self Test Policy into OTP. More...
 
int switchtec_otp_die_trace_prog (struct switchtec_dev *dev, uint8_t *die_trace)
 Progrom Die Trace into OTP. More...
 
int switchtec_otp_bit_byte_prog_mode_set (struct switchtec_dev *dev, bool bit_byte_mode)
 Set Bit or Byte Mode for OTP. More...
 
int switchtec_otp_smart_prog_mode_set (struct switchtec_dev *dev, bool smart_prog_mode)
 Set Smart Programming mode for OTP. More...
 
int switchtec_otp_mode_status_get (struct switchtec_dev *dev, struct otp_mode_status *otp_mode_status_str)
 Get Status of Programming Modes in OTP. More...
 
int switchtec_custid_prog (struct switchtec_dev *dev, uint16_t cust_id)
 Program given customer id into OTP. More...
 
int switchtec_active_image_index_get (struct switchtec_dev *dev, struct switchtec_active_index *index)
 Get active image index. More...
 
int switchtec_active_image_index_set (struct switchtec_dev *dev, struct switchtec_active_index *index)
 Set active image index. More...
 
int switchtec_fw_exec (struct switchtec_dev *dev, enum switchtec_bl2_recovery_mode recovery_mode)
 Execute the transferred firmware. More...
 
int switchtec_boot_resume (struct switchtec_dev *dev)
 Resume device boot. Note that after calling this function, the current 'dev' pointer is no longer valid. Before making further calls to switchtec library functions, be sure to close this pointer and get a new one by calling switchtec_open(). Also be sure to check the return value of switchtec_open() for error, as the device might not be immediately accessible after normal boot process. More...
 
int switchtec_secure_state_set (struct switchtec_dev *dev, enum switchtec_secure_state state)
 Set device secure state. More...
 
static int dbg_unlock_send_pubkey (struct switchtec_dev *dev, struct switchtec_pubkey *public_key)
 Send the public key to unlock the device. More...
 
int switchtec_dbg_unlock (struct switchtec_dev *dev, uint32_t serial, uint32_t ver_sec_unlock, struct switchtec_pubkey *public_key, struct switchtec_signature *signature)
 Unlock firmware debug features. More...
 
int switchtec_dbg_unlock_version_update (struct switchtec_dev *dev, uint32_t serial, uint32_t ver_sec_unlock, struct switchtec_pubkey *public_key, struct switchtec_signature *signature)
 Update firmware debug secure unlock version number. More...
 
int switchtec_read_sec_cfg_file (struct switchtec_dev *dev, FILE *setting_file, struct switchtec_security_cfg_set *set)
 Read security settings from config file. More...
 
static int kmsk_set_send_pubkey (struct switchtec_dev *dev, struct switchtec_pubkey *public_key)
 Set and send the public key to the device. More...
 
static int kmsk_set_send_signature (struct switchtec_dev *dev, struct switchtec_signature *signature)
 Set the KMSK send signature. More...
 
static int kmsk_set_send_kmsk (struct switchtec_dev *dev, struct switchtec_kmsk *kmsk)
 Set the KMSK (Key Management Security Key) for the device. More...
 
int switchtec_kmsk_set (struct switchtec_dev *dev, struct switchtec_pubkey *public_key, struct switchtec_signature *signature, struct switchtec_kmsk *kmsk)
 Set KMSK entry KMSK stands for Key Manifest Secure Key. It is a key used to verify Key Manifest partition, which contains keys to verify all other partitions. More...
 
int switchtec_read_kmsk_file (FILE *kmsk_file, struct switchtec_kmsk *kmsk)
 Read KMSK data from KMSK file. More...
 
int switchtec_read_signature_file (FILE *sig_file, struct switchtec_signature *signature)
 Read signature data from signature file. More...
 
int switchtec_read_uuid_file (FILE *uuid_file, struct switchtec_uuid *uuid)
 Read UUID data from UUID file. More...
 
int switchtec_read_sjtag_key_file (FILE *sjtag_file, struct otp_sjtag_key *sjtag_key)
 Read SJTAG key data from SJTAG file. More...
 
int switchtec_read_otp_config_data_file (FILE *config_file, struct otp_config_data *config_data, unsigned short config_len)
 Read OTP Config data from bin file. More...
 
int switchtec_read_self_test_policy_file (FILE *self_test_file, struct otp_self_test_policy *otp_self_test_policy)
 Read Self Test Policy from bin file. More...
 
int switchtec_read_die_trace_file (FILE *die_trace_file, struct otp_die_trace *otp_die_trace_ptr)
 Read Die Trace from die trace bin file. More...
 
int switchtec_security_state_has_kmsk (struct switchtec_security_cfg_state *state, struct switchtec_kmsk *kmsk)
 Check if secure config already has a KMSK entry KMSK stands for Key Manifest Secure Key. It is a key used to verify Key Manifest partition, which contains keys used to verify all other partitions. More...
 
int switchtec_sn_ver_get (struct switchtec_dev *dev, struct switchtec_sn_ver_info *info)
 Get serial number and security version. More...
 

Detailed Description

Manufacturing-related API functions.

These are functions used during manufacturing process. These includes functions that configure device security settings and recover device from boot failures.

Some of these functions modify device One-Time-Programming (OTP) memory, so they should be used with great caution, and you should really know what you are doing when calling these functions. FAILURE TO DO SO COULD MAKE YOUR DEVICE UNBOOTABLE!!

Function Documentation

◆ convert_spi_clk_rate()

static int convert_spi_clk_rate ( float  clk_float,
int  hi_rate 
)
static

Converts SPI clock rate from float to an integer index.

This function takes a floating-point SPI clock rate and converts it to an integer index based on predefined clock rate arrays. The function supports both high rate and normal rate conversions.

Parameters
clk_float[in] The SPI clock rate as a float.
hi_rate[in] A flag indicating whether to use the high rate clock array.
Returns
The index corresponding to the clock rate, or -1 if no match is found.

Definition at line 396 of file mfg.c.

◆ dbg_unlock_send_pubkey()

static int dbg_unlock_send_pubkey ( struct switchtec_dev *  dev,
struct switchtec_pubkey public_key 
)
static

Send the public key to unlock the device.

Parameters
dev[in] Pointer to the switchtec device structure.
public_key[in] Pointer to the structure containing the public key.
Returns
0 on success, error code on failure

Definition at line 1479 of file mfg.c.

◆ get_configs()

static int get_configs ( struct switchtec_dev *  dev,
struct get_cfgs_reply cfgs,
int *  otp_valid 
)
static

Retrieve configuration settings from the device.

Parameters
[in]devPointer to the switchtec device structure.
[out]cfgsPointer to the structure where configuration settings will be stored.
[out]otp_validPointer to an integer that will be set to true if OTP is valid, false otherwise.
Returns
0 on success, or a negative error code on failure.

Definition at line 184 of file mfg.c.

◆ get_i2c_operands()

static void get_i2c_operands ( enum switchtec_gen  gen,
uint32_t *  addr_shift,
uint32_t *  map_shift,
uint32_t *  map_mask 
)
static

Get I2C operands based on the Switchtec generation.

Parameters
[in]genThe Switchtec generation.
[out]addr_shiftPointer to store the address shift value.
[out]map_shiftPointer to store the map shift value.
[out]map_maskPointer to store the map mask value.
Returns
void

Definition at line 134 of file mfg.c.

◆ kmsk_set_send_kmsk()

static int kmsk_set_send_kmsk ( struct switchtec_dev *  dev,
struct switchtec_kmsk kmsk 
)
static

Set the KMSK (Key Management Security Key) for the device.

Parameters
[in]devPointer to the switchtec device structure.
[in]kmskPointer to the switchtec KMSK structure containing the key.
Returns
0 on success, or a negative error code on failure.

Definition at line 1727 of file mfg.c.

◆ kmsk_set_send_pubkey()

static int kmsk_set_send_pubkey ( struct switchtec_dev *  dev,
struct switchtec_pubkey public_key 
)
static

Set and send the public key to the device.

Parameters
[in]devPointer to the switchtec device structure.
[in]public_keyPointer to the structure containing the public key.
Returns
0 on success, or a negative error code on failure.

Definition at line 1675 of file mfg.c.

◆ kmsk_set_send_signature()

static int kmsk_set_send_signature ( struct switchtec_dev *  dev,
struct switchtec_signature signature 
)
static

Set the KMSK send signature.

Parameters
[in]devPointer to the switchtec device structure.
[in]signaturePointer to the switchtec signature structure.
Returns
0 on success, or a negative error code on failure.

Definition at line 1702 of file mfg.c.

◆ parse_otp_settings()

static void parse_otp_settings ( struct switchtec_security_cfg_otp_region otp,
uint32_t  flags 
)
static

Parse OTP settings from flags.

Parameters
[in,out]otpPointer to the OTP region structure to be populated.
[in]flagsFlags containing the OTP settings.
Returns
void

Definition at line 257 of file mfg.c.

◆ sjtag_debug_token_gen()

int sjtag_debug_token_gen ( uint8_t *  idcode_ptr,
uint8_t *  uuid_ptr,
uint8_t *  suv_ptr,
uint8_t *  sjtag_debug_token,
bool  verbose 
)

This Generates the Debug Token.

Parameters
idcode_ptr[in] Pointer to IDCODE
uuid_ptr[in] Pointer to UUID
suv_ptr[in] Pointer to SUV
sjtag_debug_token[out] Debug Token
verbose[in] verbose enable/disable
Returns
Returns 0 on Success and -1 on Failure

Definition at line 1002 of file mfg.c.

◆ sjtag_encode_cmd_header()

void sjtag_encode_cmd_header ( uint8_t *  cmd_header,
uint8_t  cmd 
)

This function generates the command header to send to the server.

Parameters
[in,out]cmd_headerPointer to the command header array to be filled.
[in]cmdCommand to encode in the header.
Returns
void

Definition at line 939 of file mfg.c.

◆ switchtec_active_image_index_get()

int switchtec_active_image_index_get ( struct switchtec_dev *  dev,
struct switchtec_active_index index 
)

Get active image index.

Parameters
[in]devSwitchtec device handle
[out]indexActive images indices
Returns
0 on success, error code on failure

Definition at line 1334 of file mfg.c.

◆ switchtec_active_image_index_set()

int switchtec_active_image_index_set ( struct switchtec_dev *  dev,
struct switchtec_active_index index 
)

Set active image index.

Parameters
[in]devSwitchtec device handle
[in]indexActive image indices
Returns
0 on success, error code on failure

Definition at line 1361 of file mfg.c.

◆ switchtec_boot_resume()

int switchtec_boot_resume ( struct switchtec_dev *  dev)

Resume device boot. Note that after calling this function, the current 'dev' pointer is no longer valid. Before making further calls to switchtec library functions, be sure to close this pointer and get a new one by calling switchtec_open(). Also be sure to check the return value of switchtec_open() for error, as the device might not be immediately accessible after normal boot process.

Parameters
[in]devSwitchtec device handle
Returns
0 on success, error code on failure

Definition at line 1444 of file mfg.c.

◆ switchtec_chip_serial_num_prog()

int switchtec_chip_serial_num_prog ( struct switchtec_dev *  dev,
uint32_t  chip_serial_num 
)

Program the chip serial number for a Switchtec device.

Parameters
dev[in] Pointer to the Switchtec device structure.
chip_serial_num[in] The chip serial number to be programmed.
Returns
int Status of the operation.

Definition at line 749 of file mfg.c.

◆ switchtec_custid_prog()

int switchtec_custid_prog ( struct switchtec_dev *  dev,
uint16_t  cust_id 
)

Program given customer id into OTP.

Parameters
[in]devSwitchtec device handle
[out]cust_idCustomer ID to be programmed
Returns
0 on success, error code on failure

Definition at line 1313 of file mfg.c.

◆ switchtec_dbg_unlock()

int switchtec_dbg_unlock ( struct switchtec_dev *  dev,
uint32_t  serial,
uint32_t  ver_sec_unlock,
struct switchtec_pubkey public_key,
struct switchtec_signature signature 
)

Unlock firmware debug features.

Parameters
[in]devSwitchtec device handle
[in]serialDevice serial number
[in]ver_sec_unlockSecure unlock version
[in]public_keypublic key data
[in]signatureSignature of data sent
Returns
0 on success, error code on failure

Definition at line 1506 of file mfg.c.

◆ switchtec_dbg_unlock_version_update()

int switchtec_dbg_unlock_version_update ( struct switchtec_dev *  dev,
uint32_t  serial,
uint32_t  ver_sec_unlock,
struct switchtec_pubkey public_key,
struct switchtec_signature signature 
)

Update firmware debug secure unlock version number.

Parameters
[in]devSwitchtec device handle
[in]serialDevice serial number
[in]ver_sec_unlockNew secure unlock version
[in]public_keypublic key data
[in]signatureSignature of data sent
Returns
0 on success, error code on failure

Definition at line 1542 of file mfg.c.

◆ switchtec_fw_exec()

int switchtec_fw_exec ( struct switchtec_dev *  dev,
enum switchtec_bl2_recovery_mode  recovery_mode 
)

Execute the transferred firmware.

Parameters
[in]devSwitchtec device handle
[in]recovery_modeRecovery mode in case of a boot failure
Returns
0 on success, error code on failure

Definition at line 1416 of file mfg.c.

◆ switchtec_kmsk_set()

int switchtec_kmsk_set ( struct switchtec_dev *  dev,
struct switchtec_pubkey public_key,
struct switchtec_signature signature,
struct switchtec_kmsk kmsk 
)

Set KMSK entry KMSK stands for Key Manifest Secure Key. It is a key used to verify Key Manifest partition, which contains keys to verify all other partitions.

Parameters
[in]devSwitchtec device handle
[in]public_keyPublic key
[in]signatureSignature
[in]kmskKMSK entry data
Returns
0 on success, error code on failure

Definition at line 1757 of file mfg.c.

◆ switchtec_mailbox_to_file()

int switchtec_mailbox_to_file ( struct switchtec_dev *  dev,
int  fd 
)

Retrieve mailbox entries.

Parameters
[in]devSwitchtec device handle
[in]fdFile handle to write the log data
Returns
0 on success, error code on failure

Definition at line 355 of file mfg.c.

◆ switchtec_mfg_cmd()

static int switchtec_mfg_cmd ( struct switchtec_dev *  dev,
uint32_t  cmd,
const void *  payload,
size_t  payload_len,
void *  resp,
size_t  resp_len 
)
static

Execute a manufacturing command on the Switchtec device.

Parameters
[in]devPointer to the Switchtec device structure.
[in]cmdCommand to be executed.
[in]payloadPointer to the payload data.
[in]payload_lenLength of the payload data.
[out]respPointer to the response buffer.
[in]resp_lenLength of the response buffer.
Returns
0 on success, -1 on failure with errno set.

Definition at line 2004 of file mfg.c.

◆ switchtec_otp_bit_byte_prog_mode_set()

int switchtec_otp_bit_byte_prog_mode_set ( struct switchtec_dev *  dev,
bool  bit_byte_mode 
)

Set Bit or Byte Mode for OTP.

Parameters
[in]devSwitchtec device handle
[in]bit_byte_modeFlag to indicate Bit or Byte mode
Returns
0 on success, error code on failure

Definition at line 1258 of file mfg.c.

◆ switchtec_otp_config_prog()

int switchtec_otp_config_prog ( struct switchtec_dev *  dev,
uint16_t  config_len,
uint8_t *  config_data,
bool  is_firmware_halt 
)

Programs the OTP configuration on the Switchtec device.

Parameters
dev[in] Pointer to the Switchtec device structure.
config_len[in] Length of the configuration data.
config_data[in] Pointer to the configuration data.
is_firmware_halt[in] Boolean flag indicating if the firmware should halt.
Returns
int Status of the operation.

Definition at line 606 of file mfg.c.

◆ switchtec_otp_config_read()

int switchtec_otp_config_read ( struct switchtec_dev *  dev,
uint16_t  config_start_address,
int32_t  config_length,
int  out_fd 
)

Reads OTP configuration data from the device.

Parameters
[in]devPointer to the switchtec device structure.
[in]config_start_addressThe starting address of the configuration data to read.
[in]config_lengthThe length of the configuration data to read.
[in]out_fdThe file descriptor to write the configuration data to.
Returns
0 on success, -1 on failure.

Definition at line 643 of file mfg.c.

◆ switchtec_otp_die_trace_prog()

int switchtec_otp_die_trace_prog ( struct switchtec_dev *  dev,
uint8_t *  die_trace 
)

Progrom Die Trace into OTP.

Parameters
[in]devSwitchtec device handle
[in]die_tracePointer to array that contains die_trace
Returns
0 on success, error code on failure

Definition at line 1236 of file mfg.c.

◆ switchtec_otp_mode_status_get()

int switchtec_otp_mode_status_get ( struct switchtec_dev *  dev,
struct otp_mode_status otp_mode_status_str 
)

Get Status of Programming Modes in OTP.

Parameters
[in]devSwitchtec device handle
[out]otp_mode_status_strpointer to structure otp_mode_status
Returns
0 on success, error code on failure

Definition at line 1300 of file mfg.c.

◆ switchtec_otp_regs_write_protect()

int switchtec_otp_regs_write_protect ( struct switchtec_dev *  dev,
bool  sku_info,
bool  otp_config 
)

Write Protect given choice of OTP Regions.

Parameters
[in]devSwitchtec device handle
[in]sku_infoflag to write protect sku info
[in]otp_configflag to write protect otp_config
Returns
0 on success, error code on failure

Definition at line 1175 of file mfg.c.

◆ switchtec_otp_self_test_policy_set()

int switchtec_otp_self_test_policy_set ( struct switchtec_dev *  dev,
uint8_t *  self_test_policy 
)

Program Self Test Policy into OTP.

Parameters
[in]devSwitchtec device handle
[in]self_test_policyPointer to array that contains self test policy
Returns
0 on success, error code on failure

Definition at line 1214 of file mfg.c.

◆ switchtec_otp_sjtag_key_lock()

int switchtec_otp_sjtag_key_lock ( struct switchtec_dev *  dev)

Locks the SJTAG key on the specified Switchtec device.

Parameters
[in]devPointer to the Switchtec device structure.
Returns
0 on success, or a negative error code on failure.

Definition at line 729 of file mfg.c.

◆ switchtec_otp_sjtag_key_set()

int switchtec_otp_sjtag_key_set ( struct switchtec_dev *  dev,
uint8_t *  sjtag_key 
)

Set the SJTAG key in the OTP memory of the Switchtec device.

Parameters
dev[in] Pointer to the Switchtec device structure.
sjtag_key[in] Pointer to the SJTAG key to be set.
Returns
int Status of the operation.

Definition at line 579 of file mfg.c.

◆ switchtec_otp_sjtag_key_verify()

int switchtec_otp_sjtag_key_verify ( struct switchtec_dev *  dev,
uint8_t *  sjtag_key,
uint8_t *  is_verified 
)

Verify the SJTAG key in the OTP memory.

Parameters
[in]devPointer to the switchtec device structure.
[in]sjtag_keyPointer to the SJTAG key to be verified.
[out]is_verifiedPointer to a variable that will be set to 1 if the key is verified, 0 otherwise.
Returns
0 on success, or a negative error code on failure.

Definition at line 697 of file mfg.c.

◆ switchtec_otp_sjtag_mode_set()

int switchtec_otp_sjtag_mode_set ( struct switchtec_dev *  dev,
uint8_t  sjtag_mode 
)

Set the SJTAG mode for the Switchtec device.

Parameters
[in]devPointer to the Switchtec device structure.
[in]sjtag_modeThe SJTAG mode to set.
Returns
0 on success, or a negative error code on failure.

Definition at line 507 of file mfg.c.

◆ switchtec_otp_sjtag_uuid_set()

int switchtec_otp_sjtag_uuid_set ( struct switchtec_dev *  dev,
uint8_t *  sjtag_uuid 
)

Set the SJTAG UUID for a Switchtec device.

Parameters
[in]devPointer to the Switchtec device structure.
[in]sjtag_uuidPointer to the SJTAG UUID to be set.
Returns
0 on success, or a negative error code on failure.

Definition at line 555 of file mfg.c.

◆ switchtec_otp_sku_info_get()

int switchtec_otp_sku_info_get ( struct switchtec_dev *  dev,
struct otp_sku_info_get sku_info_get_str 
)

Get SKU Information and Write Protected Status.

Parameters
[in]devSwitchtec device handle
[out]sku_info_get_strPointer to structure that contains sku information
Returns
0 on success, error code on failure

Definition at line 1200 of file mfg.c.

◆ switchtec_otp_sku_info_set()

int switchtec_otp_sku_info_set ( struct switchtec_dev *  dev,
struct otp_sku_info_set sku_info_set_str 
)

Set the SKU information in the OTP memory of the Switchtec device.

Parameters
[in]devPointer to the Switchtec device structure.
[in]sku_info_set_strPointer to the structure containing SKU information to be set.
Returns
0 on success, or a negative error code on failure.

Definition at line 772 of file mfg.c.

◆ switchtec_otp_smart_prog_mode_set()

int switchtec_otp_smart_prog_mode_set ( struct switchtec_dev *  dev,
bool  smart_prog_mode 
)

Set Smart Programming mode for OTP.

Parameters
[in]devSwitchtec device handle
[in]smart_prog_modeFlag to smart programming mode for OTP
Returns
0 on success, error code on failure

Definition at line 1279 of file mfg.c.

◆ switchtec_read_die_trace_file()

int switchtec_read_die_trace_file ( FILE *  die_trace_file,
struct otp_die_trace otp_die_trace_ptr 
)

Read Die Trace from die trace bin file.

Parameters
[in]die_trace_fileDie Trace file
[out]otp_die_trace_ptrPointer to otp_die_trace structure
Returns
0 on success, error code on failure

Definition at line 1952 of file mfg.c.

◆ switchtec_read_kmsk_file()

int switchtec_read_kmsk_file ( FILE *  kmsk_file,
struct switchtec_kmsk kmsk 
)

Read KMSK data from KMSK file.

Parameters
[in]kmsk_fileKMSK file
[out]kmskKMSK entry data
Returns
0 on success, error code on failure

Definition at line 1820 of file mfg.c.

◆ switchtec_read_otp_config_data_file()

int switchtec_read_otp_config_data_file ( FILE *  config_file,
struct otp_config_data config_data,
unsigned short  config_len 
)

Read OTP Config data from bin file.

Parameters
[in]config_fileOTP Config File
[out]config_dataArray of Config data
[in]config_lenLength of the config data
Returns
0 on success, error code on failure

Definition at line 1914 of file mfg.c.

◆ switchtec_read_sec_cfg_file()

int switchtec_read_sec_cfg_file ( struct switchtec_dev *  dev,
FILE *  setting_file,
struct switchtec_security_cfg_set set 
)

Read security settings from config file.

Parameters
[in]devSwitchtec device handle
[in]setting_fileSecurity setting file
[out]setSecurity settings
Returns
0 on success, error code on failure

Definition at line 1577 of file mfg.c.

◆ switchtec_read_self_test_policy_file()

int switchtec_read_self_test_policy_file ( FILE *  self_test_file,
struct otp_self_test_policy otp_self_test_policy 
)

Read Self Test Policy from bin file.

Parameters
[in]self_test_fileSelf test policy file
[out]otp_self_test_policySelf Test Policy Structure
Returns
0 on success, error code on failure

Definition at line 1933 of file mfg.c.

◆ switchtec_read_signature_file()

int switchtec_read_signature_file ( FILE *  sig_file,
struct switchtec_signature signature 
)

Read signature data from signature file.

Parameters
[in]sig_fileSignature file
[out]signatureSignature data
Returns
0 on success, error code on failure

Definition at line 1857 of file mfg.c.

◆ switchtec_read_sjtag_debug_token_file()

int switchtec_read_sjtag_debug_token_file ( FILE *  debug_token_file,
struct sjtag_debug_token debug_token 
)

This function fetches the Debug Token from a bin file.

Parameters
[in]debug_token_filePointer to the .bin file.
[out]debug_tokenPointer to the structure where the Debug Token will be stored.
Returns
0 on success, or -EBADF on failure.

Definition at line 1155 of file mfg.c.

◆ switchtec_read_sjtag_key_file()

int switchtec_read_sjtag_key_file ( FILE *  sjtag_file,
struct otp_sjtag_key sjtag_key 
)

Read SJTAG key data from SJTAG file.

Parameters
[in]sjtag_fileSJTAG file
[out]sjtag_keySJTAG key data
Returns
0 on success, error code on failure

Definition at line 1894 of file mfg.c.

◆ switchtec_read_uuid_file()

int switchtec_read_uuid_file ( FILE *  uuid_file,
struct switchtec_uuid uuid 
)

Read UUID data from UUID file.

Parameters
[in]uuid_fileUUID file
[out]uuidUUID data
Returns
0 on success, error code on failure

Definition at line 1875 of file mfg.c.

◆ switchtec_secure_state_set()

int switchtec_secure_state_set ( struct switchtec_dev *  dev,
enum switchtec_secure_state  state 
)

Set device secure state.

Parameters
[in]devSwitchtec device handle
[in]stateSecure state
Returns
0 on success, error code on failure

Definition at line 1456 of file mfg.c.

◆ switchtec_security_config_get()

int switchtec_security_config_get ( struct switchtec_dev *  dev,
struct switchtec_security_cfg_state state 
)

Get secure boot configurations.

Parameters
[in]devSwitchtec device handle
[out]stateCurrent secure boot settings
Returns
0 on success, error code on failure

Definition at line 284 of file mfg.c.

◆ switchtec_security_config_set()

int switchtec_security_config_set ( struct switchtec_dev *  dev,
struct switchtec_security_cfg_set setting 
)

Set secure settings.

Parameters
[in]devSwitchtec device handle
[out]settingSecure boot settings
Returns
0 on success, error code on failure

Definition at line 435 of file mfg.c.

◆ switchtec_security_spi_avail_rate_get()

int switchtec_security_spi_avail_rate_get ( struct switchtec_dev *  dev,
struct switchtec_security_spi_avail_rate rates 
)

Get the available SPI rates for the Switchtec device.

Parameters
[in]devPointer to the Switchtec device structure.
[out]ratesPointer to the structure to store the available SPI rates.
Returns
0 on success, or a negative error code on failure.

Definition at line 228 of file mfg.c.

◆ switchtec_security_state_has_kmsk()

int switchtec_security_state_has_kmsk ( struct switchtec_security_cfg_state state,
struct switchtec_kmsk kmsk 
)

Check if secure config already has a KMSK entry KMSK stands for Key Manifest Secure Key. It is a key used to verify Key Manifest partition, which contains keys used to verify all other partitions.

Parameters
[in]stateSecure config
[out]kmskKMSK entry to check for
Returns
0 on success, error code on failure

Definition at line 1976 of file mfg.c.

◆ switchtec_sjtag_get_nonce()

int switchtec_sjtag_get_nonce ( struct switchtec_dev *  dev,
struct sjtag_nonce sjtag_nonce_ptr 
)

Retrieve the SJTAG nonce from the device.

Parameters
[in]devPointer to the switchtec device structure.
[out]sjtag_nonce_ptrPointer to the structure where the nonce will be stored.
Returns
0 on success, or a negative error code on failure.

Definition at line 833 of file mfg.c.

◆ switchtec_sjtag_get_uuid_idcode()

int switchtec_sjtag_get_uuid_idcode ( struct switchtec_dev *  dev,
uint8_t *  sjtag_uuid_ptr,
uint8_t *  sjtag_idcode 
)

Retrieve the UUID and ID code from the switchtec device.

Parameters
[in]devPointer to the switchtec device structure.
[out]sjtag_uuid_ptrPointer to the structure where the UUID will be stored.
[out]sjtag_idcodePointer to the structure where the ID code will be stored.
Returns
0 on success, or a negative error code on failure.

Definition at line 800 of file mfg.c.

◆ switchtec_sjtag_hr_send()

int switchtec_sjtag_hr_send ( struct switchtec_dev *  dev,
uint8_t *  sjtag_hr 
)

Send SJTAG host response to the device.

Parameters
[in]devPointer to the switchtec device structure.
[in]sjtag_hrPointer to the SJTAG host response data.
Returns
0 on success, or a negative error code on failure.

Definition at line 530 of file mfg.c.

◆ switchtec_sjtag_status_get()

int switchtec_sjtag_status_get ( struct switchtec_dev *  dev,
struct sjtag_status_get sjtag_sts_get 
)

Get the SJTAG status from the switchtec device.

Parameters
[in]devPointer to the switchtec device structure.
[out]sjtag_sts_getPointer to the structure where the SJTAG status will be stored.
Returns
0 on success, or a negative error code on failure.

Definition at line 864 of file mfg.c.

◆ switchtec_sn_ver_get()

int switchtec_sn_ver_get ( struct switchtec_dev *  dev,
struct switchtec_sn_ver_info info 
)

Get serial number and security version.

Parameters
[in]devSwitchtec device handle
[out]infoSerial number and security version info
Returns
0 on success, error code on failure

Definition at line 2022 of file mfg.c.