1 /** 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * 15 * Description: hal rkp register header. \n 16 * 17 * History: \n 18 * 2023-03-22, Create file. \n 19 */ 20 #ifndef HAL_RKP_REG_H 21 #define HAL_RKP_REG_H 22 23 #define RKP_LOCK_CPU_IDLE 0 24 #define RKP_LOCK_CPU_REE 1 25 #define RKP_LOCK_CPU_TEE 2 26 #define RKP_LOCK_CPU_PCPU 4 27 #define RKP_LOCK_CPU_AIDSP 5 28 29 /* Current CPU ID Status . 30 8'h35: AIDSP; 31 8'h6a: PCPU; 32 8'ha5: TEE; 33 8'haa: ACPU. 34 */ 35 #define PCPU_STAT 0x6a 36 #define AIDSP_STAT 0x35 37 #define TEE_STAT 0xa5 38 #define ACPU_STAT 0xaa 39 40 /* 41 * rkp 42 */ 43 #define RKP_LOCK (0x000) 44 #define RKP_CMD_CFG (0x004) 45 #define KDF_ERROR (0x008) 46 #define RKP_DEOB_CFG (0x020) 47 #define DEOB_ERROR (0x028) 48 #define RK_RDY (0x050) 49 #define RKP_USD_DIS (0x054) 50 #define RKP_LOW_POWER (0x058) 51 #define RKP_INIT (0x05C) 52 #define SW_CFG (0x060) 53 #define RKP_RAW_INT (0x010) 54 #define RKP_INT_ENABLE (0x014) 55 #define RKP_INT (0x018) 56 #define RKP_PBKDF2_DATA(a) (0x100 + 4 * (a)) /* a 0~31 */ 57 #define RKP_PBKDF2_KEY(a) (0x180 + 4 * (a)) /* a 0~31 */ 58 #define RKP_PBKDF2_VAL(b) (0x200 + 4 * (b)) /* b 0~16 */ 59 #define RKP_USD(c) (0x300 + 4 * (c)) /* c 0~8 */ 60 #define RKP_SALT(e) (0x340 + 4 * (e)) /* e 0~6 */ 61 #define RKP_ONEWAY (0x360) 62 #define RKP_ALARM (0x400) 63 64 /* Define the union U_RKP_RKP_LOCK */ 65 typedef union { 66 /* Define the struct bits */ 67 struct { 68 unsigned int km_lock_status : 3; /* [2..0] */ 69 unsigned int reserved : 29; /* [31..3] */ 70 } bits; 71 /* Define an unsigned member */ 72 unsigned int u32; 73 } rkp_lock; 74 75 /* Define the union U_RKP_CMD_CFG */ 76 typedef union { 77 /* Define the struct bits */ 78 struct { 79 unsigned int sw_calc_req : 1; /* [0] */ 80 unsigned int pbkdf2_alg_sel_cfg : 3; /* [3..1] */ 81 unsigned int pbkdf2_key_sel_cfg : 5; /* [8..4] */ 82 unsigned int reserved : 5; /* [13..9] */ 83 unsigned int pbkdf2_key_len : 2; /* [15..14] */ 84 unsigned int rkp_pbkdf_calc_time : 16; /* [31..16] */ 85 } bits; 86 /* Define an unsigned member */ 87 unsigned int u32; 88 } rkp_cmd_cfg; 89 90 /* Define the union rkp_oneway_ree */ 91 typedef union { 92 /* Define the struct bits */ 93 struct { 94 unsigned int pbkdf2_rdrk_oneway : 1; /* [0] */ 95 unsigned int pbkdf2_abrk_oneway : 1; /* [1] */ 96 unsigned int pbkdf2_odrk1_oneway : 1; /* [2] */ 97 unsigned int reserved : 29; /* [31..3] */ 98 } bits; 99 /* Define an unsigned member */ 100 unsigned int u32; 101 } rkp_oneway_ree; 102 103 /* Define the union rkp_deob_cfg */ 104 typedef union { 105 /* Define the struct bits */ 106 struct { 107 unsigned int deob_update_req : 1; /* [0] */ 108 unsigned int deob_update_sel : 2; /* [2..1] */ 109 unsigned int deob_update_alg_sel : 1; /* [3] */ 110 unsigned int reserved : 29; /* [31..4] */ 111 } bits; 112 /* Define an unsigned member */ 113 unsigned int u32; 114 } rkp_deob_cfg; 115 116 /* Define the union rkp_int_enable */ 117 typedef union { 118 /* Define the struct bits */ 119 struct { 120 unsigned int rkp_int_enable : 1; /* [0] */ 121 unsigned int reserved : 31; /* [31..1] */ 122 } bits; 123 /* Define an unsigned member */ 124 unsigned int u32; 125 } rkp_int_cfg; 126 127 /* Define the union rkp_int */ 128 typedef union { 129 /* Define the struct bits */ 130 struct { 131 unsigned int rkp_int : 1; /* [0] */ 132 unsigned int reserved : 31; /* [31..1] */ 133 } bits; 134 /* Define an unsigned member */ 135 unsigned int u32; 136 } rkp_int_status; 137 138 #endif