Switchtec Userspace  PROJECT_NUMBER = PROJECT_NUMBER=PROJECT_NUMBER = 2.2
Functions
Manufacturing Functions

Manufacturing-related API functions. More...

Functions

int switchtec_sn_ver_get (struct switchtec_dev *dev, struct switchtec_sn_ver_info *info)
 Get serial number and security version. 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...
 
int switchtec_security_config_set (struct switchtec_dev *dev, struct switchtec_security_cfg_set *setting)
 Set secure settings. 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...
 
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 (FILE *setting_file, struct switchtec_security_cfg_set *set)
 Read security settings from config file. 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_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...
 

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

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 306 of file mfg.c.

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 333 of file mfg.c.

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 416 of file mfg.c.

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 470 of file mfg.c.

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 506 of file mfg.c.

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 388 of file mfg.c.

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 675 of file mfg.c.

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 219 of file mfg.c.

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 737 of file mfg.c.

int switchtec_read_sec_cfg_file ( FILE *  setting_file,
struct switchtec_security_cfg_set set 
)

Read security settings from config file.

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

Definition at line 540 of file mfg.c.

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 774 of file mfg.c.

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 428 of file mfg.c.

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 152 of file mfg.c.

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 255 of file mfg.c.

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 798 of file mfg.c.

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 127 of file mfg.c.