Lines Matching +full:- +full:chs
7 * your option) any later version. See the COPYING file in the top-level
13 #include "s390-ccw.h"
14 #include "s390-arch.h"
49 return !memcmp(&vd->ident[0], vol_desc_magic, 5) && in is_iso_vd_valid()
50 vd->version == 0x1 && in is_iso_vd_valid()
51 vd->type <= VOL_DESC_TYPE_PARTITION; in is_iso_vd_valid()
67 if (!magic_match(bip->magic, ZIPL_MAGIC)) { in verify_boot_info()
69 return -EINVAL; in verify_boot_info()
71 if (bip->version != BOOT_INFO_VERSION) { in verify_boot_info()
73 return -EINVAL; in verify_boot_info()
75 if (bip->bp_type != BOOT_INFO_BP_TYPE_IPL) { in verify_boot_info()
77 return -ENODEV; in verify_boot_info()
79 if (bip->dev_type != BOOT_INFO_DEV_TYPE_ECKD) { in verify_boot_info()
81 return -ENODEV; in verify_boot_info()
83 if (bip->flags != BOOT_INFO_FLAGS_ARCH) { in verify_boot_info()
85 return -EINVAL; in verify_boot_info()
87 if (!block_size_ok(bip->bp.ipl.bm_ptr.eckd.bptr.size)) { in verify_boot_info()
89 return -EINVAL; in verify_boot_info()
101 *c = ptr->ldptr.chs.cylinder; in eckd_format_chs()
102 *h = ptr->ldptr.chs.head; in eckd_format_chs()
103 *s = ptr->ldptr.chs.sector; in eckd_format_chs()
105 *c = ptr->bptr.chs.cylinder; in eckd_format_chs()
106 *h = ptr->bptr.chs.head; in eckd_format_chs()
107 *s = ptr->bptr.chs.sector; in eckd_format_chs()
119 + s - 1; /* block nr starts with zero */ in eckd_chs_to_block()
123 static block_number_t eckd_block_num(EckdCHS *chs) in eckd_block_num() argument
125 return eckd_chs_to_block(chs->cylinder, chs->head, chs->sector); in eckd_block_num()
183 if (j == (max_bprs_entries - 1)) { in load_eckd_segments()
195 * If an invalid address is found during LD-IPL then break and in load_eckd_segments()
196 * retry as CCW-IPL, otherwise abort on error in load_eckd_segments()
247 for (i = 0; i <= virtio_get_block_size() - 4; i++) { in find_zipl_boot_menu_banner()
270 return -EIO; in eckd_get_boot_menu_index()
277 cur_block_nr = eckd_block_num(&s1b->seek[i].chs); in eckd_get_boot_menu_index()
285 return -EIO; in eckd_get_boot_menu_index()
296 return -EIO; in eckd_get_boot_menu_index()
301 next_block_nr = eckd_block_num(&s1b->seek[i + 1].chs); in eckd_get_boot_menu_index()
307 return -EIO; in eckd_get_boot_menu_index()
330 /* The S1B block number is NULL_BLOCK_NR if and only if it's an LD-IPL */ in run_eckd_boot_script()
340 return -EINVAL; in run_eckd_boot_script()
346 return -EIO; in run_eckd_boot_script()
349 block_nr = gen_eckd_block_num(&bmt->entry[loadparm].xeckd, ldipl); in run_eckd_boot_script()
352 return -EIO; in run_eckd_boot_script()
358 return -EIO; in run_eckd_boot_script()
361 for (i = 0; bms->entry[i].type == BOOT_SCRIPT_LOAD || in run_eckd_boot_script()
362 bms->entry[i].type == BOOT_SCRIPT_SIGNATURE; i++) { in run_eckd_boot_script()
365 if (bms->entry[i].type == BOOT_SCRIPT_SIGNATURE) { in run_eckd_boot_script()
369 address = bms->entry[i].address.load_address; in run_eckd_boot_script()
370 block_nr = gen_eckd_block_num(&bms->entry[i].blkptr.xeckd, ldipl); in run_eckd_boot_script()
375 return ldipl ? 0 : -EIO; in run_eckd_boot_script()
380 if (ldipl && bms->entry[i].type != BOOT_SCRIPT_EXEC) { in run_eckd_boot_script()
381 /* Abort LD-IPL and retry as CCW-IPL */ in run_eckd_boot_script()
385 if (bms->entry[i].type != BOOT_SCRIPT_EXEC) { in run_eckd_boot_script()
387 return -EINVAL; in run_eckd_boot_script()
389 write_reset_psw(bms->entry[i].address.load_address); in run_eckd_boot_script()
391 return -1; in run_eckd_boot_script()
407 return -EIO; in ipl_eckd_cdl()
410 mbr = &ipl2->mbr; in ipl_eckd_cdl()
415 if (!block_size_ok(mbr->blockptr.xeckd.bptr.size)) { in ipl_eckd_cdl()
419 if (mbr->dev_type != DEV_TYPE_ECKD) { in ipl_eckd_cdl()
420 puts("Non-ECKD device type in zIPL section of IPL2 record."); in ipl_eckd_cdl()
425 bmt_block_nr = eckd_block_num(&mbr->blockptr.xeckd.bptr.chs); in ipl_eckd_cdl()
428 s1b_block_nr = eckd_block_num(&ipl2->stage1.seek[0].chs); in ipl_eckd_cdl()
433 return -EIO; in ipl_eckd_cdl()
435 if (!magic_match(vlbl->key, VOL1_MAGIC)) { in ipl_eckd_cdl()
439 if (!magic_match(vlbl->f.key, VOL1_MAGIC)) { in ipl_eckd_cdl()
443 print_volser(vlbl->f.volser); in ipl_eckd_cdl()
455 switch (vlbl->LDL_version) { in print_eckd_ldl_msg()
463 msg[0] = ebc2asc[vlbl->LDL_version]; in print_eckd_ldl_msg()
468 print_volser(vlbl->volser); in print_eckd_ldl_msg()
485 return -EIO; in ipl_eckd_ldl()
488 if (!magic_match(ipl1->bip.magic, ZIPL_MAGIC)) { in ipl_eckd_ldl()
493 verify_boot_info(&ipl1->bip); in ipl_eckd_ldl()
496 bmt_block_nr = eckd_block_num(&ipl1->bip.bp.ipl.bm_ptr.eckd.bptr.chs); in ipl_eckd_ldl()
499 s1b_block_nr = eckd_block_num(&ipl1->stage1.seek[0].chs); in ipl_eckd_ldl()
516 if (!magic_match(br->magic, ZIPL_MAGIC)) { in eckd_find_bmt()
517 /* If the boot record is invalid, return and try CCW-IPL instead */ in eckd_find_bmt()
521 return gen_eckd_block_num(&br->pgt.xeckd, 1); in eckd_find_bmt()
533 *p-- = '0' + (n % 10); in print_eckd_msg()
537 *p-- = ' '; in print_eckd_msg()
547 block_number_t ldipl_bmt; /* Boot Map Table for List-Directed IPL */ in ipl_eckd()
555 return -EIO; in ipl_eckd()
559 * First check for a list-directed-format pointer which would in ipl_eckd()
562 if (eckd_valid_address((ExtEckdBlockPtr *)&vlbl->f.br, 0)) { in ipl_eckd()
563 ldipl_bmt = eckd_find_bmt((ExtEckdBlockPtr *)&vlbl->f.br); in ipl_eckd()
566 return -EIO; in ipl_eckd()
568 break; /* Invalid BMT but the device may still boot with CCW-IPL */ in ipl_eckd()
570 puts("List-Directed"); in ipl_eckd()
572 * LD-IPL does not use the S1B bock, just make it NULL_BLOCK_NR. in ipl_eckd()
576 return -EIO; in ipl_eckd()
578 /* Non-fatal error, retry as CCW-IPL */ in ipl_eckd()
585 return -EIO; in ipl_eckd()
589 /* Not list-directed */ in ipl_eckd()
590 if (magic_match(vtoc->magic, VOL1_MAGIC)) { in ipl_eckd()
592 return -1; in ipl_eckd()
596 if (magic_match(vtoc->magic, CMS1_MAGIC)) { in ipl_eckd()
599 if (magic_match(vtoc->magic, LNX1_MAGIC)) { in ipl_eckd()
604 return -1; in ipl_eckd()
628 blockno = entry->data.blockno; in zipl_load_segment()
629 address = entry->compdat.load_addr; in zipl_load_segment()
639 return -EIO; in zipl_load_segment()
652 if (i == (max_entries - 1)) { in zipl_load_segment()
670 return -EIO; in zipl_load_segment()
685 if (virtio_read(pte->blockno, tmp_sec)) { in zipl_run()
687 return -EIO; in zipl_run()
693 return -EINVAL; in zipl_run()
695 if (header->type != ZIPL_COMP_HEADER_IPL) { in zipl_run()
697 return -EINVAL; in zipl_run()
704 while (entry->component_type == ZIPL_COMP_ENTRY_LOAD || in zipl_run()
705 entry->component_type == ZIPL_COMP_ENTRY_SIGNATURE) { in zipl_run()
708 if (entry->component_type == ZIPL_COMP_ENTRY_SIGNATURE) { in zipl_run()
714 return -1; in zipl_run()
721 return -EINVAL; in zipl_run()
725 if (entry->component_type != ZIPL_COMP_ENTRY_EXEC) { in zipl_run()
727 return -EINVAL; in zipl_run()
731 write_reset_psw(entry->compdat.load_psw); in zipl_run()
733 return -1; in zipl_run()
749 return -EIO; in ipl_scsi()
752 if (!magic_match(mbr->magic, ZIPL_MAGIC)) { in ipl_scsi()
757 debug_print_int("MBR Version", mbr->version_id); in ipl_scsi()
758 IPL_check(mbr->version_id == 1, in ipl_scsi()
760 debug_print_int("program table", mbr->pt.blockno); in ipl_scsi()
761 if (!mbr->pt.blockno) { in ipl_scsi()
763 return -EINVAL; in ipl_scsi()
767 if (virtio_read(mbr->pt.blockno, sec)) { in ipl_scsi()
769 return -EIO; in ipl_scsi()
773 return -EINVAL; in ipl_scsi()
777 if (prog_table->entry[i].scsi.blockno) { in ipl_scsi()
786 return -EINVAL; in ipl_scsi()
796 return -EINVAL; in ipl_scsi()
799 return zipl_run(&prog_table->entry[loadparm].scsi); in ipl_scsi()
810 if (s->unused || !s->sector_count) { in is_iso_bc_entry_compatible()
813 if (virtio_read(bswap32(s->load_rba), magic_sec)) { in is_iso_bc_entry_compatible()
818 /* Checking bytes 8 - 32 for S390 Linux magic */ in is_iso_bc_entry_compatible()
832 IsoDirHdr *cur_record = &vd->vd.primary.rootdir; in iso_get_file_size()
838 return -EIO; in iso_get_file_size()
841 sec_loc[0] = iso_733_to_u32(cur_record->ext_loc); in iso_get_file_size()
848 return -EIO; in iso_get_file_size()
856 return -EIO; in iso_get_file_size()
860 dir_rem[level] = iso_733_to_u32(cur_record->data_len) - in iso_get_file_size()
861 cur_record->dr_len; in iso_get_file_size()
862 sec_offset[level] += cur_record->dr_len; in iso_get_file_size()
865 dir_rem[level] -= cur_record->dr_len; in iso_get_file_size()
866 sec_offset[level] += cur_record->dr_len; in iso_get_file_size()
871 if (!cur_record->dr_len || sec_offset[level] == ISO_SECTOR_SIZE) { in iso_get_file_size()
872 /* Zero-padding and/or the end of current sector */ in iso_get_file_size()
873 dir_rem[level] -= ISO_SECTOR_SIZE - sec_offset[level]; in iso_get_file_size()
878 if (load_rba == iso_733_to_u32(cur_record->ext_loc)) { in iso_get_file_size()
879 return iso_733_to_u32(cur_record->data_len); in iso_get_file_size()
882 dir_rem[level] -= cur_record->dr_len; in iso_get_file_size()
883 sec_offset[level] += cur_record->dr_len; in iso_get_file_size()
885 if (cur_record->file_flags & 0x2) { in iso_get_file_size()
887 if (level == ISO9660_MAX_DIR_DEPTH - 1) { in iso_get_file_size()
888 puts("ISO-9660 directory depth limit exceeded"); in iso_get_file_size()
891 sec_loc[level] = iso_733_to_u32(cur_record->ext_loc); in iso_get_file_size()
901 level--; in iso_get_file_size()
904 return -EIO; in iso_get_file_size()
924 blks_to_load = (real_size + ISO_SECTOR_SIZE - 1) / ISO_SECTOR_SIZE; in load_iso_bc_entry()
952 while (is_iso_vd_valid(vd) && vd->type != VOL_DESC_TERMINATOR) { in find_iso_bc()
953 if (vd->type == VOL_DESC_TYPE_BOOT) { in find_iso_bc()
954 IsoVdElTorito *et = &vd->vd.boot; in find_iso_bc()
956 if (!memcmp(&et->el_torito[0], el_torito_magic, 32)) { in find_iso_bc()
957 return bswap32(et->bc_offset); in find_iso_bc()
1000 loadparm--; in find_iso_bc_entry()
1019 return -1; in ipl_iso_el_torito()
1022 puts("No suitable boot entry found on ISO-9660 media!"); in ipl_iso_el_torito()
1023 return -EIO; in ipl_iso_el_torito()
1068 /* Is it an ISO image in non-CD drive? */ in zipl_load_vscsi()
1087 if (vdev->is_cdrom) { in zipl_load()