Velocity Userspace
mfg.h
1 /*
2  * Microsemi Switchtec(tm) PCIe Management Library
3  * Copyright (c) 2019, Microsemi Corporation
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21  * OTHER DEALINGS IN THE SOFTWARE.
22  *
23  */
24 
25 #ifndef LIBSWITCHTEC_MFG_H
26 #define LIBSWITCHTEC_MFG_H
27 
28 /* Bit value for strap configurations in PCI100x */
29 #define SPI_QUAD_MODE (0U)
30 #define INLINE_ECC_MODE (1U)
31 #define SPI_3B_4B_MODE (8U)
32 #define XIP_MODE (9U)
33 #define WATCHDOG_EN (10U)
34 #define TWI_RCVRY_ADDR0 (12U)
35 #define TWI_RCVRY_ADDR1 (13U)
36 #define SEC_BOOT_DRY_RUN (14U)
37 #define PE_MODE_EN (15U)
38 #define MEMBIST_EN (16U)
39 #define MEMBIST_CPU_RESET (17U)
40 
41 #define PCI100X_STRAP_STAT(strap, bit) ((((strap >> bit) & 0x01) == 0x01) ? "Enabled" : "Disabled")
42 
43 #define SWITCHTEC_MB_LOG_LEN 32
44 
45 #define SWITCHTEC_PUB_KEY_LEN 512
46 #define SWITCHTEC_SIG_LEN 512
47 #define SWITCHTEC_KMSK_LEN 64
48 #define SWITCHTEC_KMSK_NUM 4
49 
50 #define SWITCHTEC_SECURITY_SPI_RATE_MAX_NUM 16
51 
52 #define OTP_SJTAG_UUID_LENGTH 10
53 #define OTP_SJTAG_KEY_LENGTH 16
54 #define OTP_SELF_TEST_POLICY_LENGTH 4
55 #define OTP_DIE_TRACE_LENGTH 16
56 #define OTP_CONFIG_DATA_MAX_LEN 1020
57 
58 #define OTP_CONFIG_START 0x1800
59 #define OTP_MAX_SIZE 0x3FFF
60 
61 #define SKU_NO_OF_BLOCKS 4
62 
63 #define SJTAG_SERVER_IP "10.40.56.34"
64 #define SJTAG_SERVER_PORT (5001)
65 #define SJTAG_SERVER_HEADER_LEN (4)
66 #define SJTAG_IDCODE_LEN (4)
67 #define SJTAG_HR_LEN (32)
68 #define SJTAG_DEBUG_TOKEN_LEN (32)
69 #define SJTAG_HMAC_MSG_LEN (22)
70 #define SJTAG_UUID_LEN (10)
71 #define SJTAG_UNLOCK_STR_LEN (18)
72 #define SUV_LEN (4)
73 #define SJTAG_NONCE_LEN (32)
74 #define SJTAG_SHA256_MSG_LEN (SJTAG_DEBUG_TOKEN_LEN + SJTAG_NONCE_LEN)
75 
76 /*SJTAG Server Header index */
77 #define SJTAG_SERVER_CMD_INDEX (0)
78 #define SJTAG_SERVER_CMD_RESP_INDICATOR_INDEX (1)
79 #define SJTAG_SERVER_RESPONSE_STATUS_INDEX (2)
80 
81 /* SJTAG Server Header command masks */
82 #define SJTAG_SERVER_CMD_MSK (0x00)
83 #define SJTAG_SERVER_RESP_MSK (0x40)
84 
85 /* SJTAG Server Header Commands*/
86 #define SJTAG_SERVER_CMD_CHAL_RESP (0x01)
87 
88 /* Responses from the SJTAG Server */
89 #define SERVER_STATUS_SUCCESS (0x00)
90 #define SERVER_STATUS_INVALID_SJTAGID (0x02)
91 #define SERVER_STATUS_INVALID_HEADER (0x01)
92 #define SERVER_STATUS_DIGEST_COMPUTE_FAIL (0x03)
93 
94 #define MAX_LENGTH 256
95 
96 #define KEY_BUF_SIZE (16*1024)
97 #define CONFIG_SECTION_NAME "OTPGEN_CONFIG"
98 
99 
100 #define KEY_XDATA_WRITE "XWRE_"
101 #define KEY_XDATA_SET "XSET_"
102 #define KEY_XDATA_CLEAR "XCLR_"
103 #define KEY_PATCH_CODE "CODE_"
104 
105 #define KEY_ID_SIZE 5
106 #define SET_XDATA_ADDRESS 0x80
107 
108 #define TV_TAG_SKIP_CMD_MASK 0x80
109 #define TV_TAG_SKIP_LEN_MASK_ 0x7F
110 #define TV_TAG_DATA_LEN_MASK_ 0x7F
111 
112 #define CUSTOM_COMMAND 0xFE
113 #define STOP 0xFF
114 #define SET_XMODE_NONE 0x55
115 
116 typedef unsigned long DWORD_PTR, *PDWORD_PTR;
117 
118 #define LOBYTE(w) ((BYTE)(((DWORD_PTR)(w)) & 0xff))
119 #define HIBYTE(w) ((BYTE)((((DWORD_PTR)(w)) >> 8) & 0xff))
120 #define LOWORD(l) ((WORD)(((DWORD_PTR)(l)) & 0xffff))
121 #define HIWORD(l) ((WORD)((((DWORD_PTR)(l)) >> 16) & 0xffff))
122 
123 
124 typedef unsigned long DWORD;
125 typedef int BOOL;
126 typedef unsigned char BYTE;
127 typedef unsigned short WORD;
128 
129 #define FALSE 0
130 #define TRUE 1
131 
133  uint32_t chip_serial;
134  uint32_t ver_km;
135  uint32_t ver_bl2;
136  uint32_t ver_main;
137  uint32_t ver_sec_unlock;
138  uint16_t customer_id;
139 };
140 enum switchtec_debug_mode {
141  SWITCHTEC_DEBUG_MODE_ENABLED,
142  SWITCHTEC_DEBUG_MODE_DISABLED_BUT_ENABLE_ALLOWED,
143  SWITCHTEC_DEBUG_MODE_DISABLED,
144  SWITCHTEC_DEBUG_MODE_DISABLED_EXT
145 };
146 
147 enum switchtec_secure_state {
148  SWITCHTEC_UNINITIALIZED_UNSECURED,
149  SWITCHTEC_INITIALIZED_UNSECURED,
150  SWITCHTEC_INITIALIZED_SECURED,
151  SWITCHTEC_SECURE_STATE_UNKNOWN = 0xff,
152 };
153 
157 enum switchtec_otp_program_status {
158  SWITCHTEC_OTP_PROGRAMMABLE = 0,
159  SWITCHTEC_OTP_UNPROGRAMMABLE = 1,
160 };
161 
163  bool basic_valid;
164  bool mixed_ver_valid;
165  bool main_fw_ver_valid;
166  bool sec_unlock_ver_valid;
167  bool kmsk_valid[4];
168  enum switchtec_otp_program_status basic;
169  enum switchtec_otp_program_status mixed_ver;
170  enum switchtec_otp_program_status main_fw_ver;
171  enum switchtec_otp_program_status sec_unlock_ver;
172  enum switchtec_otp_program_status kmsk[4];
173 };
174 
176  uint8_t basic_setting_valid;
177  uint8_t public_key_num_valid;
178  uint8_t public_key_ver_valid;
179  uint8_t kmsk_valid;
180 
181  enum switchtec_secure_state secure_state;
182 
183  float spi_clk_rate;
184  uint32_t i2c_recovery_tmo;
185  uint32_t i2c_port;
186  uint32_t i2c_addr;
187  uint32_t i2c_cmd_map;
188  uint32_t public_key_exponent;
189  uint32_t public_key_num;
190  uint32_t public_key_ver;
191 
192  uint8_t public_key[SWITCHTEC_KMSK_NUM][SWITCHTEC_KMSK_LEN];
193 
194  bool otp_valid;
196 };
197 
199  float spi_clk_rate;
200  uint32_t i2c_recovery_tmo;
201  uint32_t i2c_port;
202  uint32_t i2c_addr;
203  uint32_t i2c_cmd_map;
204  uint32_t public_key_exponent;
205 };
206 
207 enum switchtec_active_index_id {
208  SWITCHTEC_ACTIVE_INDEX_0 = 0,
209  SWITCHTEC_ACTIVE_INDEX_1 = 1,
210  SWITCHTEC_ACTIVE_INDEX_NOT_SET = 0xfe
211 };
212 
214  enum switchtec_active_index_id bl2;
215  enum switchtec_active_index_id firmware;
216  enum switchtec_active_index_id config;
217  enum switchtec_active_index_id keyman;
218 };
219 
220 enum switchtec_bl2_recovery_mode {
221  SWITCHTEC_BL2_RECOVERY_I2C = 1,
222  SWITCHTEC_BL2_RECOVERY_XMODEM = 2,
223  SWITCHTEC_BL2_RECOVERY_I2C_AND_XMODEM = 3
224 };
225 
227  uint8_t kmsk[SWITCHTEC_KMSK_LEN];
228 };
229 
231  uint8_t pubkey[SWITCHTEC_PUB_KEY_LEN];
232  uint32_t pubkey_exp;
233 };
234 
236  uint8_t block_num;
237  uint8_t sku_info;
238 };
239 
241  uint8_t sku_info[SKU_NO_OF_BLOCKS];
242  uint8_t write_protected:1;
243  uint8_t valid_flags:SKU_NO_OF_BLOCKS;
244  uint8_t rsvd:3;
245 };
246 
248  uint8_t idcode[SJTAG_IDCODE_LEN];
249 };
250 
252  uint32_t data;
253 };
254 
255 struct sjtag_uuid {
256  uint8_t uuid[SJTAG_UUID_LEN];
257 };
258 
259 struct sjtag_nonce {
260  uint8_t nonce[SJTAG_NONCE_LEN];
261 };
262 
264  uint8_t debug_token[SJTAG_DEBUG_TOKEN_LEN];
265 };
266 
268  uint8_t uuid_data[OTP_SJTAG_UUID_LENGTH];
269 };
270 
272  uint8_t sjtag_key[OTP_SJTAG_KEY_LENGTH];
273 };
274 
276  uint8_t config_data[OTP_CONFIG_DATA_MAX_LEN];
277 };
278 
280  uint8_t otp_self_test_policy[OTP_SELF_TEST_POLICY_LENGTH];
281 };
282 
284  uint8_t die_trace[OTP_DIE_TRACE_LENGTH];
285 };
286 
287 #pragma pack(push,1)
290  uint32_t bit_byte_mode:1;
291  uint32_t smart_prog_mode:1;
292  uint32_t rsvd:30;
294 };
295 #pragma pack(pop)
296 
298  uint8_t signature[SWITCHTEC_SIG_LEN];
299 };
300 
302  int num_rates;
303  float rates[SWITCHTEC_SECURITY_SPI_RATE_MAX_NUM];
304 };
305 int switchtec_sn_ver_get(struct switchtec_dev *dev,
306  struct switchtec_sn_ver_info *info);
307 int switchtec_security_config_get(struct switchtec_dev *dev,
308  struct switchtec_security_cfg_state *state);
309 int switchtec_security_spi_avail_rate_get(struct switchtec_dev *dev,
310  struct switchtec_security_spi_avail_rate *rates);
311 int switchtec_security_config_set(struct switchtec_dev *dev,
312  struct switchtec_security_cfg_set *setting);
313 int switchtec_mailbox_to_file(struct switchtec_dev *dev, int fd);
314 int switchtec_active_image_index_get(struct switchtec_dev *dev,
315  struct switchtec_active_index *index);
316 int switchtec_active_image_index_set(struct switchtec_dev *dev,
317  struct switchtec_active_index *index);
318 int switchtec_fw_exec(struct switchtec_dev *dev,
319  enum switchtec_bl2_recovery_mode recovery_mode);
320 int switchtec_boot_resume(struct switchtec_dev *dev);
321 int switchtec_kmsk_set(struct switchtec_dev *dev,
322  struct switchtec_pubkey *public_key,
323  struct switchtec_signature *signature,
324  struct switchtec_kmsk *kmsk);
325 int switchtec_secure_state_set(struct switchtec_dev *dev,
326  enum switchtec_secure_state state);
327 int switchtec_dbg_unlock(struct switchtec_dev *dev, uint32_t serial,
328  uint32_t ver_sec_unlock,
329  struct switchtec_pubkey *public_key,
330  struct switchtec_signature *signature);
331 int switchtec_dbg_unlock_version_update(struct switchtec_dev *dev,
332  uint32_t serial,
333  uint32_t ver_sec_unlock,
334  struct switchtec_pubkey *public_key,
335  struct switchtec_signature *signature);
336 int switchtec_read_sec_cfg_file(struct switchtec_dev *dev,
337  FILE *setting_file,
338  struct switchtec_security_cfg_set *set);
339 int switchtec_read_pubk_file(FILE *pubk_file, struct switchtec_pubkey *pubk);
340 int switchtec_read_kmsk_file(FILE *kmsk_file, struct switchtec_kmsk *kmsk);
341 int switchtec_read_signature_file(FILE *sig_file,
342  struct switchtec_signature *sigature);
343 int switchtec_read_uuid_file(FILE *uuid_file,
344  struct switchtec_uuid *uuid_data);
345 int switchtec_read_sjtag_key_file(FILE *sjtag_file,
346  struct otp_sjtag_key *sjtag_key);
347 int switchtec_read_self_test_policy_file(FILE *self_test_file,
349 int switchtec_read_die_trace_file(FILE *die_trace_file,
350  struct otp_die_trace *otp_die_trace_ptr);
351 int
353  struct switchtec_kmsk *kmsk);
354 
355 int switchtec_otp_sku_info_set(struct switchtec_dev *dev,
356  struct otp_sku_info_set *sku_info_set_str);
357 int switchtec_otp_regs_write_protect(struct switchtec_dev *dev,
358  bool sku_info, bool otp_config);
359 int switchtec_chip_serial_num_prog(struct switchtec_dev *dev,
360  uint32_t chip_serial_num);
361 int switchtec_otp_sku_info_get(struct switchtec_dev *dev,
362  struct otp_sku_info_get *sku_info_get_str);
363 
364 int switchtec_otp_sjtag_mode_set(struct switchtec_dev *dev,
365  uint8_t sjtag_mode);
366 int switchtec_otp_sjtag_uuid_set(struct switchtec_dev *dev,
367  uint8_t *sjtag_uuid);
368 int switchtec_otp_sjtag_key_set(struct switchtec_dev *dev,
369  uint8_t *sjtag_key);
370 int switchtec_otp_sjtag_key_verify(struct switchtec_dev *dev,
371  uint8_t *sjtag_key, uint8_t *is_verified);
372 int switchtec_otp_sjtag_key_lock(struct switchtec_dev *dev);
373 int switchtec_otp_self_test_policy_set(struct switchtec_dev *dev, uint8_t *self_test_policy);
374 int switchtec_otp_die_trace_prog(struct switchtec_dev *dev, uint8_t *die_trace);
375 int switchtec_otp_bit_byte_prog_mode_set(struct switchtec_dev *dev, bool bit_byte_mode);
376 int switchtec_otp_smart_prog_mode_set(struct switchtec_dev *dev,bool smart_prog_mode);
377 int switchtec_otp_mode_status_get(struct switchtec_dev *dev, struct otp_mode_status *otp_mode_status_str);
378 int switchtec_custid_prog(struct switchtec_dev *dev, uint16_t cust_id);
379 int switchtec_otp_config_prog(struct switchtec_dev *dev,
380  uint16_t config_len,
381  uint8_t *config_data,
382  bool is_firmware_halt);
383 int switchtec_otp_config_read(struct switchtec_dev *dev,
384  uint16_t config_start_address,
385  int32_t config_length,
386  int out_fd);
387 int switchtec_read_otp_config_data_file(FILE *config_file,
388  struct otp_config_data *config_data,
389  unsigned short config_len);
390 int switchtec_sjtag_status_get(struct switchtec_dev *dev,
391  struct sjtag_status_get *sjtag_sts_get);
392 
393 int switchtec_sjtag_get_uuid_idcode(struct switchtec_dev *dev,
394  uint8_t *sjtag_uuid_ptr,
395  uint8_t *sjtag_idcode);
396 
397 int switchtec_sjtag_get_nonce(struct switchtec_dev *dev,
398  struct sjtag_nonce *sjtag_nonce_ptr);
399 
400 int switchtec_sjtag_hr_send(struct switchtec_dev *dev,
401  uint8_t *sjtag_hr);
402 
403 int switchtec_read_sjtag_debug_token_file(FILE *debug_token_file, struct sjtag_debug_token *debug_token);
404 void sjtag_hr_calc(uint8_t *sjtag_debug_token, uint8_t *sjtag_nonce, uint8_t *digest, bool verbose);
405 int sjtag_debug_token_gen(uint8_t *idcode_ptr, uint8_t *uuid_ptr, uint8_t *suv_ptr, uint8_t *sjtag_debug_token, bool verbose);
406 void sjtag_hr_compute(uint8_t *sjtag_uuid, uint8_t *sjtag_suv, uint8_t *sjtag_nonce, uint8_t *sjtag_hr);
407 
408 
409 
410 #endif // LIBSWITCHTEC_MFG_H
switchtec_read_signature_file
int switchtec_read_signature_file(FILE *sig_file, struct switchtec_signature *sigature)
Read signature data from signature file.
Definition: mfg.c:1857
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.
Definition: mfg.c:833
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.
Definition: mfg.c:643
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.
Definition: mfg.c:1577
switchtec_security_cfg_set
Definition: mfg.h:198
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 val...
Definition: mfg.c:1444
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.
Definition: mfg.c:697
switchtec_otp_die_trace_prog
int switchtec_otp_die_trace_prog(struct switchtec_dev *dev, uint8_t *die_trace)
Progrom Die Trace into OTP.
Definition: mfg.c:1236
switchtec_security_spi_avail_rate
Definition: mfg.h:301
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.
Definition: mfg.c:864
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.
Definition: mfg.c:772
switchtec_secure_state_set
int switchtec_secure_state_set(struct switchtec_dev *dev, enum switchtec_secure_state state)
Set device secure state.
Definition: mfg.c:1456
otp_sjtag_key
Definition: mfg.h:271
switchtec_security_cfg_state
Definition: mfg.h:175
switchtec_custid_prog
int switchtec_custid_prog(struct switchtec_dev *dev, uint16_t cust_id)
Program given customer id into OTP.
Definition: mfg.c:1313
switchtec_sjtag_hr_send
int switchtec_sjtag_hr_send(struct switchtec_dev *dev, uint8_t *sjtag_hr)
Send SJTAG host response to the device.
Definition: mfg.c:530
switchtec_kmsk
Definition: mfg.h:226
otp_config_data
Definition: mfg.h:275
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.
Definition: mfg.c:1258
otp_sku_info_set
Definition: mfg.h:235
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....
Definition: mfg.c:1976
sjtag_status_get
Definition: mfg.h:251
switchtec_active_image_index_get
int switchtec_active_image_index_get(struct switchtec_dev *dev, struct switchtec_active_index *index)
Get active image index.
Definition: mfg.c:1334
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.
Definition: mfg.c:1279
sjtag_idcode_get
Definition: mfg.h:247
otp_sku_info_get
Definition: mfg.h:240
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.
Definition: mfg.c:555
switchtec_pubkey
Definition: mfg.h:230
switchtec_mailbox_to_file
int switchtec_mailbox_to_file(struct switchtec_dev *dev, int fd)
Retrieve mailbox entries.
Definition: mfg.c:355
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.
Definition: mfg.c:2022
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.
Definition: mfg.c:1155
switchtec_signature
Definition: mfg.h:297
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.
Definition: mfg.c:1542
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.
Definition: mfg.c:1002
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.
Definition: mfg.c:1894
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.
Definition: mfg.c:606
switchtec_otp_sjtag_key_lock
int switchtec_otp_sjtag_key_lock(struct switchtec_dev *dev)
Locks the SJTAG key on the specified Switchtec device.
Definition: mfg.c:729
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.
Definition: mfg.c:749
switchtec_security_config_set
int switchtec_security_config_set(struct switchtec_dev *dev, struct switchtec_security_cfg_set *setting)
Set secure settings.
Definition: mfg.c:435
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.
Definition: mfg.c:1214
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.
Definition: mfg.c:228
sjtag_uuid
Definition: mfg.h:255
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.
Definition: mfg.c:1506
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.
Definition: mfg.c:507
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.
Definition: mfg.c:1200
switchtec_sn_ver_info
Definition: mfg.h:132
switchtec_read_kmsk_file
int switchtec_read_kmsk_file(FILE *kmsk_file, struct switchtec_kmsk *kmsk)
Read KMSK data from KMSK file.
Definition: mfg.c:1820
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.
Definition: mfg.c:579
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.
Definition: mfg.c:800
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.
Definition: mfg.c:1175
otp_mode_status
Definition: mfg.h:288
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.
Definition: mfg.c:1914
switchtec_active_index
Definition: mfg.h:213
switchtec_read_uuid_file
int switchtec_read_uuid_file(FILE *uuid_file, struct switchtec_uuid *uuid_data)
Read UUID data from UUID file.
Definition: mfg.c:1875
switchtec_active_image_index_set
int switchtec_active_image_index_set(struct switchtec_dev *dev, struct switchtec_active_index *index)
Set active image index.
Definition: mfg.c:1361
switchtec_security_config_get
int switchtec_security_config_get(struct switchtec_dev *dev, struct switchtec_security_cfg_state *state)
Get secure boot configurations.
Definition: mfg.c:284
switchtec_fw_exec
int switchtec_fw_exec(struct switchtec_dev *dev, enum switchtec_bl2_recovery_mode recovery_mode)
Execute the transferred firmware.
Definition: mfg.c:1416
otp_self_test_policy
Definition: mfg.h:279
sjtag_debug_token
Definition: mfg.h:263
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.
Definition: mfg.c:1933
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 parti...
Definition: mfg.c:1757
switchtec_uuid
Definition: mfg.h:267
otp_die_trace
Definition: mfg.h:283
sjtag_nonce
Definition: mfg.h:259
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.
Definition: mfg.c:1952
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.
Definition: mfg.c:1300
switchtec_security_cfg_otp_region
Definition: mfg.h:162