@@ -1118,22 +1118,31 @@ 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+ const uint8_t * pdata0 = (const uint8_t * )pctrl0 -> buffer .data ;
1128+ const uint8_t * pdata1 = (const uint8_t * )pctrl1 -> buffer .data ;
1129+
11221130 OtOTPHWCfg * hw_cfg = s -> hw_cfg ;
11231131
1124- memcpy (hw_cfg -> device_id , & otp -> data [ R_HW_CFG0_DEVICE_ID ],
1132+ memcpy (hw_cfg -> device_id , & pdata0 [ A_HW_CFG0_DEVICE_ID - pdesc0 -> offset ],
11251133 sizeof (hw_cfg -> device_id ));
1126- memcpy (hw_cfg -> manuf_state , & otp -> data [ R_HW_CFG0_MANUF_STATE ],
1134+ memcpy (hw_cfg -> manuf_state , & pdata0 [ A_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+ & pdata1 [A_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 ] :
1141+ s -> blk ? pdata1 [ A_HW_CFG1_EN_SRAM_IFETCH - pdesc1 -> offset ] :
11331142 OT_MULTIBITBOOL8_TRUE ;
11341143 /* do not prevent CSRNG app reads if no OTP configuration is loaded */
11351144 hw_cfg -> en_csrng_sw_app_read_mb8 =
1136- s -> blk ? ( uint8_t ) otp -> data [ R_HW_CFG1_EN_CSRNG_SW_APP_READ ] :
1145+ s -> blk ? pdata1 [ A_HW_CFG1_EN_CSRNG_SW_APP_READ - pdesc1 -> offset ] :
11371146 OT_MULTIBITBOOL8_TRUE ;
11381147}
11391148
0 commit comments