static void ipl_eckd_cdl(void) { XEckdMbr *mbr; Ipl2 *ipl2 = (void *)sec; IplVolumeLabel *vlbl = (void *)sec; block_number_t block_nr; /* we have just read the block #0 and recognized it as "IPL1" */ sclp_print("CDL\n"); memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(1, ipl2, "Cannot read IPL2 record at block 1"); IPL_assert(magic_match(ipl2, IPL2_MAGIC), "No IPL2 record"); mbr = &ipl2->u.x.mbr; IPL_assert(magic_match(mbr, ZIPL_MAGIC), "No zIPL section in IPL2 record."); IPL_assert(block_size_ok(mbr->blockptr.xeckd.bptr.size), "Bad block size in zIPL section of IPL2 record."); IPL_assert(mbr->dev_type == DEV_TYPE_ECKD, "Non-ECKD device type in zIPL section of IPL2 record."); /* save pointer to Boot Script */ block_nr = eckd_block_num((void *)&(mbr->blockptr)); memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(2, vlbl, "Cannot read Volume Label at block 2"); IPL_assert(magic_match(vlbl->key, VOL1_MAGIC), "Invalid magic of volume label block"); IPL_assert(magic_match(vlbl->f.key, VOL1_MAGIC), "Invalid magic of volser block"); print_volser(vlbl->f.volser); run_eckd_boot_script(block_nr); /* no return */ }
void zipl_load(void) { ScsiMbr *mbr = (void *)sec; LDL_VTOC *vlbl = (void *)sec; /* Grab the MBR */ memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(0, mbr, "Cannot read block 0"); dputs("checking magic\n"); if (magic_match(mbr->magic, ZIPL_MAGIC)) { ipl_scsi(); /* no return */ } /* We have failed to follow the SCSI scheme, so */ sclp_print("Using ECKD scheme.\n"); if (virtio_guessed_disk_nature()) { sclp_print("Using guessed DASD geometry.\n"); virtio_assume_eckd(); } if (magic_match(mbr->magic, IPL1_MAGIC)) { ipl_eckd(ECKD_CDL); /* no return */ } /* LDL/CMS? */ memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(2, vlbl, "Cannot read block 2"); if (magic_match(vlbl->magic, CMS1_MAGIC)) { ipl_eckd(ECKD_CMS); /* no return */ } if (magic_match(vlbl->magic, LNX1_MAGIC)) { ipl_eckd(ECKD_LDL); /* no return */ } virtio_panic("\n* invalid MBR magic *\n"); }
static void jump_to_IPL_2(void) { ResetInfo *current = 0; void (*ipl)(void) = (void *) (uint64_t) current->ipl_continue; debug_print_addr("set IPL addr to", ipl); /* Ensure the guest output starts fresh */ sclp_print("\n"); *current = save; ipl(); /* should not return */ }
static void ipl_eckd_ldl(ECKD_IPL_mode_t mode) { LDL_VTOC *vlbl = (void *)sec; /* already read, 3rd block */ char msg[4] = { '?', '.', '\n', '\0' }; block_number_t block_nr; BootInfo *bip; sclp_print((mode == ECKD_CMS) ? "CMS" : "LDL"); sclp_print(" version "); switch (vlbl->LDL_version) { case LDL1_VERSION: msg[0] = '1'; break; case LDL2_VERSION: msg[0] = '2'; break; default: msg[0] = vlbl->LDL_version; msg[0] &= 0x0f; /* convert EBCDIC */ msg[0] |= 0x30; /* to ASCII (digit) */ msg[1] = '?'; break; } sclp_print(msg); print_volser(vlbl->volser); /* DO NOT read BootMap pointer (only one, xECKD) at block #2 */ memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(0, sec, "Cannot read block 0"); bip = (void *)(sec + 0x70); /* "boot info" is "eckd mbr" for LDL */ verify_boot_info(bip); block_nr = eckd_block_num((void *)&(bip->bp.ipl.bm_ptr.eckd.bptr)); run_eckd_boot_script(block_nr); /* no return */ }
static void ipl_scsi(void) { ScsiMbr *mbr = (void *)sec; uint8_t *ns, *ns_end; int program_table_entries = 0; const int pte_len = sizeof(ScsiBlockPtr); ScsiBlockPtr *prog_table_entry; /* The 0-th block (MBR) was already read into sec[] */ sclp_print("Using SCSI scheme.\n"); debug_print_int("program table", mbr->blockptr.blockno); /* Parse the program table */ read_block(mbr->blockptr.blockno, sec, "Error reading Program Table"); IPL_assert(magic_match(sec, ZIPL_MAGIC), "No zIPL magic"); ns_end = sec + virtio_get_block_size(); for (ns = (sec + pte_len); (ns + pte_len) < ns_end; ns++) { prog_table_entry = (ScsiBlockPtr *)ns; if (!prog_table_entry->blockno) { break; } program_table_entries++; } debug_print_int("program table entries", program_table_entries); IPL_assert(program_table_entries != 0, "Empty Program Table"); /* Run the default entry */ prog_table_entry = (ScsiBlockPtr *)(sec + pte_len); zipl_run(prog_table_entry); /* no return */ }
void virtio_panic(const char *string) { sclp_print(string); disabled_wait(); while (1) { } }