名称
boot_linux_uos - uOS として linux を起動する
書式
int
boot_linux_uos(
mic_ctx_t * mic_ctx,
char * imgname,
char * initramfsname);
引数
- mic_ctx
- uOS を起動するカードの context
- imgname
- uOS イメージファイルのパス名
- initramfsname
- ramfs イメージファイルのパス名
説明
引数 mic_ctx で指定されたカードに、linux を起動する。
起動する linux のイメージは、引数 imgname で指定されたファイルから読みだす。
また、引数 initramfsname が NULL でなく、かつ、起動するカードが Knights Corner ファミリの場合、
引数 initrafsname で指定されたファイルを ramfs イメージファイルとして使用する。
処理の開始時に、メッセージ "MIC <カード番号> Booting" を出力する。
指定された context が MIC_BOOT 状態以外の場合、メッセージ "MIC <カード番号> is not in offline mode" を出力して、-EPERM エラー終了する。
uOS イメージの転送に失敗した場合、メッセージ "Cannot load uos in gddr" を出力してエラー終了する。
ramfs イメージの転送に失敗した場合、メッセージ "Cannot load initramfs in gddr" を出力してエラー終了する。
kernel boot command line の転送に失敗した場合、失敗を無視して起動処理を続ける。
このとき、
load_command_line がメッセージを出力する。
戻り値
処理に成功した場合、0 を返す。
そうでない場合、0 以外の値を返す。
- -EPERM
- context の状態が MIC_BOOT 以外の場合
参照
実装
678 /*
679 DESCRIPTION :: boots Linux OS on the card
680 PARAMETERS ::
681 [in]mic_ctx_t *mic_ctx - mic context
682 [in]char *imgname - file path for uos image to be loaded on the card
683 RETURN_VALUE:: 0 if successful, non-zero if failure
684 */
685 int
686 boot_linux_uos(mic_ctx_t *mic_ctx, char *imgname, char *initramfsname)
687 {
688 int status = 0;
689 uint32_t uos_size = 0;
690 uint64_t uos_cmd_offset = 0;
691 uint32_t initramfs_image = 0;
692 uint32_t initramfs_size = 0;
693
694 printk("MIC %d Booting\n", mic_ctx->bi_id);
695
696 if (mic_ctx->state != MIC_BOOT) {
697 printk(KERN_ERR "MIC %d is not in offline mode\n", mic_ctx->bi_id);
698 return -EPERM;
699 }
700
701 //loads uos image at given path into gddr
702 if ((status = [[load_uos_into_gddr]](mic_ctx, imgname, &uos_size, &uos_cmd_offset)) != 0) {
703 printk("Cannot load uos in gddr\n");
704 return status;
705 }
706
707 #ifdef INITRAMFS
708 /* For now, we only support initramfs for KNC */
709 if (mic_ctx->bi_family == FAMILY_KNC) {
710 if (initramfsname) {
711 if ((status = [[load_initramfs]](mic_ctx, initramfsname, &initramfs_image, &initramfs_size)) != 0) {
712 printk("Cannot load initramfs in gddr\n");
713 return status;
714 }
715 }
716 }
717 #endif
718
719 status = load_command_line(mic_ctx, uos_cmd_offset, initramfs_image, initramfs_size);
720
721 //program scratch register with uos image size and notify bootstrap
722 status = [[notify_uosboot]](mic_ctx, uos_size);
723
724 return status;
725 }
最終更新:2012年11月18日 15:19