blob: 460a8a91e8af1e4814d3c3e2fc62226e1e083907 [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001#ifndef SST_INTERFACE_H
2#define SST_INTERFACE_H
3
4#include "nvram_data_items.h"
5
6#define SST_PROTECTED_NVRAM_LID_READ_LIMIT 0x1
7#define SST_PROTECTED_NVRAM_LID_WRITE_LIMIT 0x2
8
9typedef struct sst_protected_nvram_lid_struct {
10 nvram_lid_enum m_lid;
11 kal_uint16 m_attr;
12} SST_PROTECTED_NVRAM_LID;
13
14typedef struct sst_allowed_task_struct {
15 module_type m_mod_id;
16} SST_ALLOWED_TASK;
17
18/*
19 * Efuse region index definition
20 */
21#define EFUSE_IDX_C_DAT0 0
22#define EFUSE_IDX_C_DAT1 1
23#define EFUSE_IDX_C_DAT2 2
24#define EFUSE_IDX_C_DAT3 3
25#define EFUSE_IDX_C_DAT4 4
26#define EFUSE_IDX_C_DAT5 5
27#define EFUSE_IDX_C_CTRL0 6
28#define EFUSE_IDX_C_CTRL1 7
29
30/*SST Efuse blowing error code*/
31#define SST_EFUSE_BLOW_DONE 0
32#define SST_EFUSE_BLOW_AP_NOT_READY 0x10000000
33#define SST_EFUSE_BLOW_DATA_FAIL 0x20000000
34#define SST_EFUSE_BLOW_START_FAIL 0x40000000
35#define SST_EFUSE_BLOW_LOCK_FAIL 0x80000000
36#define SST_EFUSE_BLOW_END_FAIL 0x01000000
37#define SST_EFUSE_BLOW_BIT_NOT_SUPPORT 0x02000000
38#define SST_EFUSE_BLOW_REGION_NOT_SUPPORT 0x04000000
39#define SST_EFUSE_BLOW_CHIP_NOT_SUPPORT 0x08000000
40#define SST_EFUSE_BLOW_NOT_INIT 0x00100000
41#define SST_EFUSE_BLOW_PROCESS_FAIL 0x00200000
42#define SST_EFUSE_BLOW_REINIT_FAIL 0x00400000
43#define SST_EFUSE_BLOW_CCCI_FAIL 0x00800000
44
45/*****************************************************************************
46 * FUNCTION
47 * SST_Get_ChipRID
48 *
49 * DESCRIPTION
50 * The function returns per-chip random ID to the caller.
51 *
52 * PARAMETERS
53 * [INPUT/OUTPUT] pRid : The buffer that is used to store the per-chip random ID.
54 * [INPUT] buf_len : Length that the caller wants for the per-chip random ID in "bits".
55 *
56 * RETURNS
57 * KAL_TRUE : Get random ID Success
58 * KAL_FALSE : Get random ID failed
59 *
60 * NOTES
61 * N/A
62 *
63 *****************************************************************************/
64extern kal_bool SST_Get_ChipRID(kal_char *pRid, kal_int32 buf_len);
65
66
67/*****************************************************************************
68 * FUNCTION
69 * SST_Get_ChipRK
70 *
71 * DESCRIPTION
72 * The function returns per-chip random key to the caller.
73 *
74 * PARAMETERS
75 * [INPUT/OUTPUT] key : The buffer that is used to store the per-chip random key.
76 * [INPUT] len : Length that the caller wants for the per-chip random key in bytes.
77 *
78 * RETURNS
79 * KAL_TRUE : Get random key Success
80 * KAL_FALSE : Get random key failed
81 *
82 * NOTES
83 * N/A
84 *
85 *****************************************************************************/
86extern kal_bool SST_Get_ChipRK(kal_char *key, kal_int32 len);
87
88/*************************************************************************
89* FUNCTION
90* SST_Get_EFUSE_Data
91*
92* DESCRIPTION
93* This function get specified length of efuse data and put in the buffer
94*
95* PARAMETERS
96* data_type - efuse field
97* buf - pointer to the buffer to store efuse data
98* len - efuse data length expected to read
99*
100* RETURNS
101* KAL_TRUE/KAL_FALSE
102*
103*************************************************************************/
104typedef enum{
105 AP_SBC_EN = 1,
106 C_CTRL0,
107 C_CTRL1,
108 C_DAT0,
109 C_DAT1,
110 C_DAT2,
111 C_DAT3,
112 C_DAT4,
113 C_DAT5,
114 C_DAT6,
115 C_DAT7,
116}EFUSE_DATA_TYPE;
117
118
119kal_bool SST_Get_EFUSE_Data(EFUSE_DATA_TYPE data_type, kal_uint8* buf, kal_uint8 len);
120
121/*************************************************************************
122* FUNCTION
123* SST_ilm_inject_check
124*
125* DESCRIPTION
126* This function checks whether input ILM is permitted to access the specified NVRAM LID
127*
128* PARAMETERS
129* ilm_ptr - read/write request ILM
130*
131* RETURNS
132* KAL_TRUE/KAL_FALSE
133* KAL_TRUE: The access is permitted, i.e. pass checking successfully
134* KAL_FALSE: The access is prohibited, i.e. fails checking
135*************************************************************************/
136
137kal_uint32 SST_ilm_inject_check(ilm_struct *ilm_ptr);
138
139#endif