load_uos_into_gddr

名称

load_uos_into_gddr - uOS イメージの転送

書式

int
load_uos_into_gddr(
    mic_ctx_t * mic_ctx,
    char *      imgname,
    uint32_t *  uos_size,
    uint64_t *  uos_cmd_offset);

引数

mic_ctx
イメージを転送するカードの context
imgname
イメージが格納されているファイルのパス名文字列
uos_size
イメージサイズ格納用の領域
uos_cmd_offset
転送後のイメージ end の apertune 内オフセット格納用領域

説明

引数 mic_ctx が示すカードに、引数 imgname が示すファイルの内容を uOS イメージとして転送する。
引数 uos_size が示す領域に、転送した uOS イメージのサイズを格納する。
引数 uos_cmd_offset が示す領域に、転送した uOS イメージの直後の aperture 内オフセットを格納する。
mic_ctx の apic_id メンバに、BSP の APIC ID を格納する。

mic_ctx の状態が MIC_BOOT 以外の場合、メッセージ "Not in booting state" を出力して -EPERM エラーを返す。

mic_get_file_size() に失敗した場合、メッセージ "image not found <パス名> , status returned <MIC_BOOTFAIL の値>" を出力してエラーを返す。
このとき mic_ctx の状態を MIC_BOOTFAIL にする。

戻り値

処理に成功した場合、引数 uos_size と uos_cmd_offset が示す領域に値を格納して、0 を返す。
そうでない場合、0 以外の値を返す。この場合、uos_size が示す領域を壊すことがある?

-EPERM
状態が MIC_BOOT 以外の場合
XXX
mic_get_file_size に失敗した場合

参照

  • XXX

実装

host/driver/uos_download.c
433 /*
434   DESCRIPTION:: loads uos image at given path into gddr
435   PARAMETERS::
436     [in]mic_ctx_t *mic_ctx - mic context
437     [in]imgname - file path for uos file to be loaded
438     [out]uos_size - size of uos image
439  */
440 int
441 load_uos_into_gddr(mic_ctx_t *mic_ctx, char *imgname, uint32_t* uos_size, uint64_t *uos_cmd_of     fset)
442 {
443         void *aperture_va;
444         uint8_t *mmio_va;
445         uint32_t apic_id = 0;
446         uint32_t uos_load_offset = 0;
447         uint32_t adapter_memsize = 0;
448         int status = 0;
449
450         aperture_va = mic_ctx->aper.va;
451         mmio_va = mic_ctx->mmio.va;
452
453         if (mic_ctx->state != MIC_BOOT) {
454                 printk("Not in booting state\n");
455                 return -EPERM;
456         }
457
458         status = mic_get_file_size(imgname, uos_size);
459         if (status) {
460                 mic_ctx->state = MIC_BOOTFAIL;
461                 printk("image not found at %s , status returned %d\n", imgname, status);
462                 return status;
463         }
464
465         status = get_uos_loadoffset(mmio_va, &uos_load_offset);
466         // Determine the uOS reserve size after we have the m_pXpu interface
467         get_adapter_memsize(mmio_va, &adapter_memsize);
468
469         status = get_apic_id(mmio_va, &apic_id);
470         // store apic_id in adapter context for later use
471         mic_ctx->apic_id = apic_id;
472
473         if (mic_ctx->bi_family == FAMILY_ABR){

478         }
479
480         // transfer uOs image file to gddr
481         status = mic_load_file(imgname, ((uint8_t*)aperture_va) + uos_load_offset, *uos_size);
482
483         // for the emulator we want to skip "downloading" the file
484         *uos_cmd_offset = (uint64_t)uos_load_offset + *uos_size;
485
486         // This only applies to KNF bootstrap, it is NOT needed for KNC
487         if (mic_ctx->bi_family == FAMILY_ABR) {

491         }
492
493         return status;
494 }

483 行目のコメントに対応する行がない。
466 行目のコメントも少し違う。
この辺りに別の処理があるらしい。
最終更新:2012年11月18日 11:53