名称
adapter_reset -
書式
void
adapter_reset(
mic_ctx_t * mic_ctx,
int wait_reset,
int reattempt);
引数
- mic_ctx
- wait_reset
- reattempt
説明
戻り値
参照
実装
996 void
997 adapter_reset(mic_ctx_t *mic_ctx, int wait_reset, int reattempt)
998 {
999 uint32_t resetReg;
1000 mutex_lock(&mic_ctx->state_lock);
1001 /* TODO: check state for lost node as well once design is done */
1002 if ((mic_ctx->state == MIC_RESET || mic_ctx->state == MIC_READY) && (reattempt == 0)) {
1003 if (wait_reset == 0) {
1004 mic_setstate(&mic_ctx->state, MIC_INVALID);
1005 del_timer_sync(&mic_ctx->boot_timer) ;
1006 mutex_unlock(&mic_ctx->state_lock);
1007 return;
1008 }
1009 mutex_unlock(&mic_ctx->state_lock);
1010 return;
1011 }
1012
1013 mic_setstate(&mic_ctx->state, MIC_RESET);
1014
1015 mutex_unlock(&mic_ctx->state_lock);
1016
1017 del_timer_sync(&mic_ctx->boot_timer) ;
1018
1019 //Write 0 to uos download status otherwise we might continue booting
1020 //before reset has completed...
1021 SBOX_WRITE(0, mic_ctx->mmio.va, [[SBOX_SCRATCH2]]);
1022
1023 // Virtual network link value should be 0 before reset
1024 SBOX_WRITE(0, mic_ctx->mmio.va, SBOX_SCRATCH14);
1025
1026 // Data from Doorbell1 about restart/shutdown should be 0 before reset
1027 SBOX_WRITE(0, mic_ctx->mmio.va, SBOX_SDBIC1);
1028
1029 //This will trigger reset
1030 resetReg = SBOX_READ(mic_ctx->mmio.va, SBOX_RGCR);
1031 resetReg |= 0x1;
1032 SBOX_WRITE(resetReg, mic_ctx->mmio.va, SBOX_RGCR);
1033
1034 /* At least of KNF it seems we really want to delay at least 1 second */
1035 /* after touching reset to prevent a lot of problems. */
1036 msleep(1000);
1037
1038 if (!wait_reset) {
1039 return;
1040 }
1041
1042 [[adapter_wait_reset]](mic_ctx);
1043 }
最終更新:2012年11月18日 16:17