名称
boot_micdev_app - uOS の起動
書式
int
boot_micdev_app(
mic_ctx_t * mic_ctx,
char * imgname);
引数
- mic_ctx
- uOS を起動するカードの context
- imgname
- uOS のイメージファイルのパス名
説明
引数 mic_ctx で指定されたカード上で、引数 imgname で指定された uOS を起動し、起動完了を確認する。
処理開始時に、メッセージ "MIC <カード番号> Booting" を出力する。
uOS の転送に失敗した場合、メッセージ "Cannot load uos in gddr" を出力してエラー終了する。
処理に成功した場合、メッセージ "ELF booted succesfully" を出力する。
処理に成功した場合、context の状態を MIC_ONLINE にし、mic_ctx->boot_count をインクリメントする。
そうでない場合、context の状態を MIC_BOOTFAIL にする。
戻り値
処理に成功した場合、0 を返す。
そうでない場合、0 以外を返す。
参照
実装
727 /*
728 DESCRIPTION :: boots Maintenance mode handler on the card
729 PARAMETERS ::
730 [in]mic_ctx_t *mic_ctx - mic context
731 [in]char *imgname - file path for uos image to be loaded on the card
732 RETURN_VALUE:: 0 if successful, non-zero if failure
733 */
734 int boot_micdev_app(mic_ctx_t *mic_ctx, char *imgname)
735 {
736 int status = 0;
737 uint32_t uos_size = 0;
738 uint8_t *mmio_va = 0;
739 uint64_t uos_cmd_offset = 0;
740
741 printk("MIC %d Booting\n", mic_ctx->bi_id);
742 mmio_va = mic_ctx->mmio.va;
743 status = [[load_uos_into_gddr]](mic_ctx, imgname, &uos_size, &uos_cmd_offset);
744 if(status) {
745 printk("Cannot load uos in gddr\n");
746 goto exit;
747 }
748
749 //program scratch register with uos image size and notify bootstrap
750 status = [[notify_uosboot]](mic_ctx, uos_size);
751 if(status)
752 goto exit;
753 status = [[wait_for_bootstrap]](mmio_va);
754 exit:
755 if(status) {
756 mic_setstate(&mic_ctx->state, MIC_BOOTFAIL);
757 } else {
758 mic_setstate(&mic_ctx->state, MIC_ONLINE);
759 mic_ctx->boot_count++;
760 printk("ELF booted succesfully\n");
761 }
762 return status;
763 }
最終更新:2012年11月18日 15:41