mirror of
https://github.com/rvtr/ctr_eFuse.git
synced 2025-11-02 00:11:04 -04:00
起動時の復旧処理を修正
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_eFuse@149 ff987cc8-cf2f-4642-8568-d52cce064691
This commit is contained in:
parent
1f5eba052d
commit
0c7d36bbf1
107
cr_hsm_code.c
107
cr_hsm_code.c
@ -316,9 +316,10 @@ int hsm_reset_module( void )
|
||||
return ret_code;
|
||||
}
|
||||
|
||||
// failed state からの復旧要求
|
||||
cmd.cmd = Cmd_RetryFailedModule;
|
||||
cmd.args.retryfailedmodule.module = HSM_MODULE_ID;
|
||||
// モジュールの状態確認
|
||||
cmd.cmd = Cmd_NewEnquiry;
|
||||
cmd.args.newenquiry.module = HSM_MODULE_ID;
|
||||
cmd.args.newenquiry.version = EnqVer_Six;
|
||||
ret_code = NFastApp_Transact( connection, NULL, &cmd, &reply, NULL );
|
||||
if ( ret_code != CR_GENID_SUCCESS )
|
||||
{
|
||||
@ -332,30 +333,84 @@ int hsm_reset_module( void )
|
||||
return ret_code;
|
||||
}
|
||||
|
||||
NFastApp_Free_Command( handle, NULL, NULL, &cmd );
|
||||
NFastApp_Free_Reply( handle, NULL, NULL, &reply );
|
||||
|
||||
memset( &cmd, 0, sizeof( cmd ) );
|
||||
memset( &reply, 0, sizeof( reply ) );
|
||||
|
||||
// モジュールのリセット
|
||||
cmd.cmd = Cmd_ClearUnit;
|
||||
cmd.args.clearunit.module = HSM_MODULE_ID;
|
||||
ret_code = NFastApp_Transact( connection, NULL, &cmd, &reply, NULL );
|
||||
if ( ret_code != CR_GENID_SUCCESS )
|
||||
// モジュールが failed state でないなら以下は必要ないので即終了
|
||||
if ( reply.reply.newenquiry.flags & Cmd_NewEnquiry_Reply_flags_Failed )
|
||||
{
|
||||
SetErrorInfo( __FUNCTION__, __LINE__ );
|
||||
return ret_code;
|
||||
}
|
||||
ret_code = reply.status;
|
||||
if ( ret_code != CR_GENID_SUCCESS )
|
||||
{
|
||||
SetErrorInfo( __FUNCTION__, __LINE__ );
|
||||
return ret_code;
|
||||
}
|
||||
|
||||
NFastApp_Free_Command( handle, NULL, NULL, &cmd );
|
||||
NFastApp_Free_Reply( handle, NULL, NULL, &reply );
|
||||
NFastApp_Free_Command( handle, NULL, NULL, &cmd );
|
||||
NFastApp_Free_Reply( handle, NULL, NULL, &reply );
|
||||
|
||||
memset( &cmd, 0, sizeof( cmd ) );
|
||||
memset( &reply, 0, sizeof( reply ) );
|
||||
|
||||
// failed state からの復旧要求
|
||||
// 必ず Status_OK を返してくるので信用できない
|
||||
cmd.cmd = Cmd_RetryFailedModule;
|
||||
cmd.args.retryfailedmodule.module = HSM_MODULE_ID;
|
||||
ret_code = NFastApp_Transact( connection, NULL, &cmd, &reply, NULL );
|
||||
if ( ret_code != CR_GENID_SUCCESS )
|
||||
{
|
||||
SetErrorInfo( __FUNCTION__, __LINE__ );
|
||||
return ret_code;
|
||||
}
|
||||
ret_code = reply.status;
|
||||
if ( ret_code != CR_GENID_SUCCESS )
|
||||
{
|
||||
SetErrorInfo( __FUNCTION__, __LINE__ );
|
||||
return ret_code;
|
||||
}
|
||||
|
||||
NFastApp_Free_Command( handle, NULL, NULL, &cmd );
|
||||
NFastApp_Free_Reply( handle, NULL, NULL, &reply );
|
||||
|
||||
memset( &cmd, 0, sizeof( cmd ) );
|
||||
memset( &reply, 0, sizeof( reply ) );
|
||||
|
||||
// モジュールのリセット
|
||||
cmd.cmd = Cmd_ClearUnit;
|
||||
cmd.args.clearunit.module = HSM_MODULE_ID;
|
||||
ret_code = NFastApp_Transact( connection, NULL, &cmd, &reply, NULL );
|
||||
if ( ret_code != CR_GENID_SUCCESS )
|
||||
{
|
||||
SetErrorInfo( __FUNCTION__, __LINE__ );
|
||||
return ret_code;
|
||||
}
|
||||
ret_code = reply.status;
|
||||
if ( ret_code != CR_GENID_SUCCESS )
|
||||
{
|
||||
SetErrorInfo( __FUNCTION__, __LINE__ );
|
||||
return ret_code;
|
||||
}
|
||||
|
||||
NFastApp_Free_Command( handle, NULL, NULL, &cmd );
|
||||
NFastApp_Free_Reply( handle, NULL, NULL, &reply );
|
||||
|
||||
memset( &cmd, 0, sizeof( cmd ) );
|
||||
memset( &reply, 0, sizeof( reply ) );
|
||||
|
||||
// モジュールの状態を再度確認
|
||||
cmd.cmd = Cmd_NewEnquiry;
|
||||
cmd.args.newenquiry.module = HSM_MODULE_ID;
|
||||
cmd.args.newenquiry.version = EnqVer_Six;
|
||||
ret_code = NFastApp_Transact( connection, NULL, &cmd, &reply, NULL );
|
||||
if ( ret_code != CR_GENID_SUCCESS )
|
||||
{
|
||||
SetErrorInfo( __FUNCTION__, __LINE__ );
|
||||
return ret_code;
|
||||
}
|
||||
ret_code = reply.status;
|
||||
if ( ret_code != CR_GENID_SUCCESS )
|
||||
{
|
||||
SetErrorInfo( __FUNCTION__, __LINE__ );
|
||||
return ret_code;
|
||||
}
|
||||
|
||||
// 復旧しないようなら終了するしかない
|
||||
if ( reply.reply.newenquiry.flags & Cmd_NewEnquiry_Reply_flags_Failed )
|
||||
{
|
||||
SetErrorInfo( __FUNCTION__, __LINE__ );
|
||||
return Status_HardwareFailed;
|
||||
}
|
||||
} // 復旧処理
|
||||
|
||||
// <20>Ø’f
|
||||
ret_code = NFastApp_Disconnect( hsmConnection, NULL );
|
||||
|
||||
Loading…
Reference in New Issue
Block a user