@@ -1118,22 +1118,34 @@ ot_otp_dj_update_status_error(OtOTPImplIf *dev, OtOTPStatus error, bool set)
11181118
11191119static void ot_otp_dj_pwr_load_hw_cfg (OtOTPEngineState * s )
11201120{
1121- OtOTPStorage * otp = s -> otp ;
1121+ OtOTPImplIfClass * ic = OT_OTP_IMPL_IF_GET_CLASS (s );
1122+
1123+ const OtOTPPartDesc * pdesc0 = & ic -> part_descs [OTP_PART_HW_CFG0 ];
1124+ const OtOTPPartDesc * pdesc1 = & ic -> part_descs [OTP_PART_HW_CFG1 ];
1125+ const OtOTPPartController * pctrl0 = & s -> part_ctrls [OTP_PART_HW_CFG0 ];
1126+ const OtOTPPartController * pctrl1 = & s -> part_ctrls [OTP_PART_HW_CFG1 ];
1127+
11221128 OtOTPHWCfg * hw_cfg = s -> hw_cfg ;
11231129
1124- memcpy (hw_cfg -> device_id , & otp -> data [R_HW_CFG0_DEVICE_ID ],
1130+ memcpy (hw_cfg -> device_id ,
1131+ & pctrl0 -> buffer .data [R_HW_CFG0_DEVICE_ID - pdesc0 -> offset ],
11251132 sizeof (hw_cfg -> device_id ));
1126- memcpy (hw_cfg -> manuf_state , & otp -> data [R_HW_CFG0_MANUF_STATE ],
1133+ memcpy (hw_cfg -> manuf_state ,
1134+ & pctrl0 -> buffer .data [R_HW_CFG0_MANUF_STATE - pdesc0 -> offset ],
11271135 sizeof (hw_cfg -> manuf_state ));
1128- memcpy (hw_cfg -> soc_dbg_state , & otp -> data [R_HW_CFG1_SOC_DBG_STATE ],
1136+ memcpy (hw_cfg -> soc_dbg_state ,
1137+ & pctrl1 -> buffer .data [R_HW_CFG1_SOC_DBG_STATE - pdesc1 -> offset ],
11291138 sizeof (hw_cfg -> soc_dbg_state ));
11301139 /* do not prevent execution from SRAM if no OTP configuration is loaded */
11311140 hw_cfg -> en_sram_ifetch_mb8 =
1132- s -> blk ? (uint8_t )otp -> data [R_HW_CFG1_EN_SRAM_IFETCH ] :
1133- OT_MULTIBITBOOL8_TRUE ;
1141+ s -> blk ?
1142+ (uint8_t )
1143+ pctrl1 -> buffer .data [R_HW_CFG1_EN_SRAM_IFETCH - pdesc1 -> offset ] :
1144+ OT_MULTIBITBOOL8_TRUE ;
11341145 /* do not prevent CSRNG app reads if no OTP configuration is loaded */
11351146 hw_cfg -> en_csrng_sw_app_read_mb8 =
1136- s -> blk ? (uint8_t )otp -> data [R_HW_CFG1_EN_CSRNG_SW_APP_READ ] :
1147+ s -> blk ? (uint8_t )pctrl1 -> buffer
1148+ .data [R_HW_CFG1_EN_CSRNG_SW_APP_READ - pdesc1 -> offset ] :
11371149 OT_MULTIBITBOOL8_TRUE ;
11381150}
11391151
0 commit comments