Lines Matching +full:fast +full:- +full:read
27 * This file contains the functions for performing Fast Reboot -- a
34 * kernel and boot archive to be passed to the fast reboot switcher
50 * that the system is capable of fast reboot. It jumps to the fast reboot
107 * Data structure containing necessary information for the fast reboot
119 /* Index into Fast Reboot not supported message array */
122 /* Fast Reboot not supported message array */
137 * Reserve memory below PA 1G in preparation of fast reboot.
160 * Minimum system uptime in clock_t before Fast Reboot should be used
234 #define BOOTARCHIVE32_FAILSAFE "/boot/x86.miniroot-safe"
235 #define BOOTARCHIVE64_FAILSAFE "/boot/amd64/x86.miniroot-safe"
247 PRIx64" bytes below %s to do fast reboot";
269 return ((va >> nk->fi_shift_amt[level]) & (nk->fi_ptes_per_table - 1)); in fastboot_vatoindex()
286 table = (x86pte_t *)(nk->fi_pagetable_va); in fastboot_map_with_size()
288 for (l = nk->fi_top_level; l >= level; l--) { in fastboot_map_with_size()
298 vaddr += (1ULL << nk->fi_shift_amt[l]), in fastboot_map_with_size()
299 paddr += (1ULL << nk->fi_shift_amt[l])) { in fastboot_map_with_size()
314 - nk->fi_pagetable_pa) + nk->fi_pagetable_va); in fastboot_map_with_size()
320 if (l == nk->fi_top_level) { in fastboot_map_with_size()
321 ASSERT(nk->fi_top_level == 3); in fastboot_map_with_size()
322 table[index] = nk->fi_next_table_pa | ptp_bits; in fastboot_map_with_size()
324 table[index] = nk->fi_next_table_pa | ptp_bits; in fastboot_map_with_size()
326 table = (x86pte_t *)(nk->fi_next_table_va); in fastboot_map_with_size()
327 nk->fi_next_table_va += MMU_PAGESIZE; in fastboot_map_with_size()
328 nk->fi_next_table_pa += MMU_PAGESIZE; in fastboot_map_with_size()
349 fake_va = P2ALIGN_TYPED(fake_va, nk->fi_lpagesize, uintptr_t); in fastboot_build_pagetables()
351 nk->fi_files[0].fb_pte_list_va[0] & MMU_PAGEMASK, PAGESIZE, 0); in fastboot_build_pagetables()
366 if ((ehdr->e_phoff + ehdr->e_phnum * ehdr->e_phentsize) >= imgsz) in fastboot_elf64_find_dboot_load_offset()
367 return (-1); in fastboot_elf64_find_dboot_load_offset()
369 phdrbase = (uint8_t *)img + ehdr->e_phoff; in fastboot_elf64_find_dboot_load_offset()
371 for (i = 0; i < ehdr->e_phnum; i++) { in fastboot_elf64_find_dboot_load_offset()
372 phdr = (Elf64_Phdr *)(phdrbase + ehdr->e_phentsize * i); in fastboot_elf64_find_dboot_load_offset()
374 if (phdr->p_type == PT_LOAD) { in fastboot_elf64_find_dboot_load_offset()
375 if (phdr->p_vaddr == phdr->p_paddr && in fastboot_elf64_find_dboot_load_offset()
376 phdr->p_vaddr == DBOOT_ENTRY_ADDRESS) { in fastboot_elf64_find_dboot_load_offset()
377 ASSERT(phdr->p_offset <= UINT32_MAX); in fastboot_elf64_find_dboot_load_offset()
378 *offp = (uint32_t)phdr->p_offset; in fastboot_elf64_find_dboot_load_offset()
384 return (-1); in fastboot_elf64_find_dboot_load_offset()
389 * Initialize text and data section information for 32-bit kernel.
390 * sectcntp - is both input/output parameter.
405 if ((ehdr->e_phoff + ehdr->e_phnum * ehdr->e_phentsize) >= imgsz) in fastboot_elf32_find_loadables()
406 return (-1); in fastboot_elf32_find_loadables()
408 phdrbase = (uint8_t *)img + ehdr->e_phoff; in fastboot_elf32_find_loadables()
410 for (i = 0; i < ehdr->e_phnum; i++) { in fastboot_elf32_find_loadables()
411 phdr = (Elf32_Phdr *)(phdrbase + ehdr->e_phentsize * i); in fastboot_elf32_find_loadables()
413 if (phdr->p_type == PT_INTERP) in fastboot_elf32_find_loadables()
414 return (-1); in fastboot_elf32_find_loadables()
416 if (phdr->p_type != PT_LOAD) in fastboot_elf32_find_loadables()
419 if (phdr->p_vaddr == phdr->p_paddr && in fastboot_elf32_find_loadables()
420 phdr->p_paddr == DBOOT_ENTRY_ADDRESS) { in fastboot_elf32_find_loadables()
421 *offp = (uint32_t)phdr->p_offset; in fastboot_elf32_find_loadables()
424 return (-1); in fastboot_elf32_find_loadables()
426 sectp[used_sections].fb_sec_offset = phdr->p_offset; in fastboot_elf32_find_loadables()
427 sectp[used_sections].fb_sec_paddr = phdr->p_paddr; in fastboot_elf32_find_loadables()
428 sectp[used_sections].fb_sec_size = phdr->p_filesz; in fastboot_elf32_find_loadables()
430 (phdr->p_filesz < phdr->p_memsz) ? in fastboot_elf32_find_loadables()
431 (phdr->p_memsz - phdr->p_filesz) : 0; in fastboot_elf32_find_loadables()
438 return (-1); in fastboot_elf32_find_loadables()
484 if (nk->fi_mbi_size && nk->fi_mbi_size < size) { in fastboot_build_mbi()
485 contig_free((void *)nk->fi_new_mbi_va, nk->fi_mbi_size); in fastboot_build_mbi()
486 nk->fi_mbi_size = 0; in fastboot_build_mbi()
489 if (nk->fi_mbi_size == 0) { in fastboot_build_mbi()
490 if ((nk->fi_new_mbi_va = in fastboot_build_mbi()
495 return (-1); in fastboot_build_mbi()
501 nk->fi_mbi_size = size; in fastboot_build_mbi()
507 bzero((void *)nk->fi_new_mbi_va, nk->fi_mbi_size); in fastboot_build_mbi()
512 start_addr_va = nk->fi_new_mbi_va; in fastboot_build_mbi()
515 nk->fi_new_mbi_pa = (paddr_t)start_addr_pa; in fastboot_build_mbi()
522 * Copy from the saved mbi to preserve all non-pointer type fields. in fastboot_build_mbi()
533 mbi->mods_addr = start_addr_pa + offs; in fastboot_build_mbi()
535 mbp->mod_start = nk->fi_files[FASTBOOT_BOOTARCHIVE].fb_dest_pa; in fastboot_build_mbi()
536 mbp->mod_end = nk->fi_files[FASTBOOT_BOOTARCHIVE].fb_next_pa; in fastboot_build_mbi()
542 mbp->mod_name = start_addr_pa + offs; in fastboot_build_mbi()
543 mbp->reserved = 0; in fastboot_build_mbi()
546 * Make sure the offset is 16-byte aligned to avoid unaligned access. in fastboot_build_mbi()
554 mbi->mmap_addr = start_addr_pa + offs; in fastboot_build_mbi()
562 mbi->drives_addr = start_addr_pa + offs; in fastboot_build_mbi()
571 mbi->cmdline = start_addr_pa + offs; in fastboot_build_mbi()
581 bzero(&mbi->config_table, in fastboot_build_mbi()
582 sizeof (*mbi) - offsetof(multiboot_info_t, config_table)); in fastboot_build_mbi()
583 mbi->flags &= ~(MB_INFO_CONFIG_TABLE | MB_INFO_BOOT_LOADER_NAME | in fastboot_build_mbi()
596 nk->fi_has_pae = 1; in fastboot_init_fields()
597 nk->fi_shift_amt = fastboot_shift_amt_pae; in fastboot_init_fields()
598 nk->fi_ptes_per_table = 512; in fastboot_init_fields()
599 nk->fi_lpagesize = (2 << 20); /* 2M */ in fastboot_init_fields()
600 nk->fi_top_level = 3; in fastboot_init_fields()
618 if (mdep[0] != '-') { in fastboot_parse_mdep()
625 if (i < 4 || strncmp(&mdep[i-4], "unix", 4) != 0) { in fastboot_parse_mdep()
671 if (nk->fi_valid) in fastboot_reserve_mem()
678 fastboot_file_t *fb = &nk->fi_files[i]; in fastboot_reserve_mem()
684 if ((fb->fb_pte_list_va = contig_alloc(size, in fastboot_reserve_mem()
688 fb->fb_pte_list_size = size; in fastboot_reserve_mem()
694 if ((nk->fi_pagetable_va = in fastboot_reserve_mem()
699 nk->fi_pagetable_size = fastboot_pagetable_size; in fastboot_reserve_mem()
704 if ((nk->fi_new_mbi_va = (uintptr_t)contig_alloc(fastboot_mbi_size, in fastboot_reserve_mem()
708 nk->fi_mbi_size = fastboot_mbi_size; in fastboot_reserve_mem()
721 MD5Update(&md5_ctx, (void *)fb->fb_va, fb->fb_size); in fastboot_cksum_file()
733 fsize_roundup = P2ROUNDUP_TYPED(fb->fb_size, PAGESIZE, size_t); in fastboot_free_file()
735 contig_free((void *)fb->fb_va, fsize_roundup); in fastboot_free_file()
736 fb->fb_va = 0; in fastboot_free_file()
737 fb->fb_size = 0; in fastboot_free_file()
747 if (fb->fb_pte_list_size && fb->fb_pte_list_pa < endaddr) { in fastboot_free_file_pte()
748 contig_free((void *)fb->fb_pte_list_va, fb->fb_pte_list_size); in fastboot_free_file_pte()
749 fb->fb_pte_list_va = 0; in fastboot_free_file_pte()
750 fb->fb_pte_list_pa = 0; in fastboot_free_file_pte()
751 fb->fb_pte_list_size = 0; in fastboot_free_file_pte()
765 fastboot_free_file(nk->fi_files + i); in fastboot_free_mem()
766 fastboot_free_file_pte(nk->fi_files + i, endaddr); in fastboot_free_mem()
769 if (nk->fi_pagetable_size && nk->fi_pagetable_pa < endaddr) { in fastboot_free_mem()
770 contig_free((void *)nk->fi_pagetable_va, nk->fi_pagetable_size); in fastboot_free_mem()
771 nk->fi_pagetable_va = 0; in fastboot_free_mem()
772 nk->fi_pagetable_pa = 0; in fastboot_free_mem()
773 nk->fi_pagetable_size = 0; in fastboot_free_mem()
776 if (nk->fi_mbi_size && nk->fi_new_mbi_pa < endaddr) { in fastboot_free_mem()
777 contig_free((void *)nk->fi_new_mbi_va, nk->fi_mbi_size); in fastboot_free_mem()
778 nk->fi_new_mbi_va = 0; in fastboot_free_mem()
779 nk->fi_new_mbi_pa = 0; in fastboot_free_mem()
780 nk->fi_mbi_size = 0; in fastboot_free_mem()
793 nk->fi_valid = 0; in fastboot_free_newkernel()
798 fastboot_free_file(&(nk->fi_files[i])); in fastboot_free_newkernel()
810 MD5Update(&md5_ctx, nk->fi_files[i].fb_pte_list_va, in fastboot_cksum_cdata()
811 nk->fi_files[i].fb_pte_list_size); in fastboot_cksum_cdata()
813 MD5Update(&md5_ctx, (void *)nk->fi_pagetable_va, nk->fi_pagetable_size); in fastboot_cksum_cdata()
814 MD5Update(&md5_ctx, (void *)nk->fi_new_mbi_va, nk->fi_mbi_size); in fastboot_cksum_cdata()
828 fastboot_cksum_file(nk->fi_files + i, nk->fi_md5_hash[i]); in fastboot_cksum_generate()
830 fastboot_cksum_cdata(nk, nk->fi_md5_hash[i]); in fastboot_cksum_generate()
844 fastboot_cksum_file(nk->fi_files + i, md5_hash); in fastboot_cksum_verify()
845 if (bcmp(nk->fi_md5_hash[i], md5_hash, in fastboot_cksum_verify()
846 sizeof (nk->fi_md5_hash[i])) != 0) in fastboot_cksum_verify()
851 if (bcmp(nk->fi_md5_hash[i], md5_hash, in fastboot_cksum_verify()
852 sizeof (nk->fi_md5_hash[i])) != 0) in fastboot_cksum_verify()
860 * - Read the sizes of the new kernel and boot archive.
861 * - Allocate memory for the new kernel and boot archive.
862 * - Allocate memory for page tables necessary for mapping the memory
864 * - Read the new kernel and boot archive into memory.
865 * - Map in the fast reboot switcher.
866 * - Load the fast reboot switcher to FASTBOOT_SWTCH_PA.
867 * - Build the new multiboot_info structure
868 * - Build page tables for the low 1G of physical memory.
869 * - Mark the data structure as valid if all steps have succeeded.
922 (sizeof (FAILSAFE_BOOTFILE32) - 1)) == 0 || in fastboot_load_kernel()
924 (sizeof (FAILSAFE_BOOTFILE64) - 1)) == 0) { in fastboot_load_kernel()
930 * Read in unix and boot_archive in fastboot_load_kernel()
947 (struct _buf *)-1) { in fastboot_load_kernel()
964 * relocated by the fast boot switcher. in fastboot_load_kernel()
1020 cmn_err(CE_NOTE, "!Fastboot: Couldn't read %s", in fastboot_load_kernel()
1026 fb->fb_va = va; in fastboot_load_kernel()
1027 fb->fb_size = fsize; in fastboot_load_kernel()
1028 fb->fb_sectcnt = 0; in fastboot_load_kernel()
1035 if (fb->fb_pte_list_size && fb->fb_pte_list_size < pt_size) { in fastboot_load_kernel()
1036 contig_free((void *)fb->fb_pte_list_va, in fastboot_load_kernel()
1037 fb->fb_pte_list_size); in fastboot_load_kernel()
1038 fb->fb_pte_list_size = 0; in fastboot_load_kernel()
1041 if (fb->fb_pte_list_size == 0) { in fastboot_load_kernel()
1042 if ((fb->fb_pte_list_va = in fastboot_load_kernel()
1055 fb->fb_pte_list_size = pt_size; in fastboot_load_kernel()
1058 bzero((void *)(fb->fb_pte_list_va), fb->fb_pte_list_size); in fastboot_load_kernel()
1060 fb->fb_pte_list_pa = mmu_ptob((uint64_t)hat_getpfnum(kas.a_hat, in fastboot_load_kernel()
1061 (caddr_t)fb->fb_pte_list_va)); in fastboot_load_kernel()
1063 for (page_index = 0, offset = 0; offset < fb->fb_size; in fastboot_load_kernel()
1068 (caddr_t)fb->fb_va + offset)); in fastboot_load_kernel()
1076 fb->fb_pte_list_va[page_index++] = (x86pte_t) in fastboot_load_kernel()
1080 fb->fb_pte_list_va[page_index] = FASTBOOT_TERMINATE; in fastboot_load_kernel()
1090 if (ehdr->e_ident[j] != ELFMAG[j]) { in fastboot_load_kernel()
1097 if (ehdr->e_ident[EI_CLASS] == ELFCLASS32 && in fastboot_load_kernel()
1098 ehdr->e_ident[EI_DATA] == ELFDATA2LSB && in fastboot_load_kernel()
1099 ehdr->e_machine == EM_386) { in fastboot_load_kernel()
1101 fb->fb_sectcnt = sizeof (fb->fb_sections) / in fastboot_load_kernel()
1102 sizeof (fb->fb_sections[0]); in fastboot_load_kernel()
1105 fsize, &fb->fb_sections[0], in fastboot_load_kernel()
1106 &fb->fb_sectcnt, &dboot_start_offset) < 0) { in fastboot_load_kernel()
1112 if (fb->fb_sectcnt == 0) { in fastboot_load_kernel()
1133 } else if (ehdr->e_ident[EI_CLASS] == ELFCLASS64 && in fastboot_load_kernel()
1134 ehdr->e_ident[EI_DATA] == ELFDATA2LSB && in fastboot_load_kernel()
1135 ehdr->e_machine == EM_AMD64) { in fastboot_load_kernel()
1151 "not a 64-bit capable system", in fastboot_load_kernel()
1175 fb->fb_dest_pa = DBOOT_ENTRY_ADDRESS - in fastboot_load_kernel()
1178 fb->fb_next_pa = DBOOT_ENTRY_ADDRESS + fsize_roundup; in fastboot_load_kernel()
1180 fb->fb_dest_pa = newkernel.fi_files[i - 1].fb_next_pa; in fastboot_load_kernel()
1181 fb->fb_next_pa = fb->fb_dest_pa + fsize_roundup; in fastboot_load_kernel()
1189 * Add the function that will switch us to 32-bit protected mode in fastboot_load_kernel()
1192 fb->fb_va = fb->fb_dest_pa = FASTBOOT_SWTCH_PA; in fastboot_load_kernel()
1193 fb->fb_size = MMU_PAGESIZE; in fastboot_load_kernel()
1195 hat_devload(kas.a_hat, (caddr_t)fb->fb_va, in fastboot_load_kernel()
1196 MMU_PAGESIZE, mmu_btop(fb->fb_dest_pa), in fastboot_load_kernel()
1211 * 1 page for Page-Directory-Pointer Table in fastboot_load_kernel()
1250 size - MMU_PAGESIZE; in fastboot_load_kernel()
1284 fastboot_file_t *fb = &nk->fi_files[FASTBOOT_SWTCH]; in fastboot_xc_func()
1285 fastboot_func = (void (*)())(fb->fb_va); in fastboot_xc_func()
1286 kthread_t *t_intr = curthread->t_intr; in fastboot_xc_func()
1288 if (&kas != curproc->p_as) { in fastboot_xc_func()
1289 hat_devload(curproc->p_as->a_hat, (caddr_t)fb->fb_va, in fastboot_xc_func()
1290 MMU_PAGESIZE, mmu_btop(fb->fb_dest_pa), in fastboot_xc_func()
1299 if (t_intr && t_intr->t_procp->p_as->a_hat != curproc->p_as->a_hat && in fastboot_xc_func()
1300 t_intr->t_procp->p_as != &kas) in fastboot_xc_func()
1301 hat_devload(t_intr->t_procp->p_as->a_hat, (caddr_t)fb->fb_va, in fastboot_xc_func()
1302 MMU_PAGESIZE, mmu_btop(fb->fb_dest_pa), in fastboot_xc_func()
1314 * Jump to the fast reboot switcher. This function never returns.
1334 if (&kas != curproc->p_as) { in fast_reboot()
1335 hat_devload(curproc->p_as->a_hat, (caddr_t)fb->fb_va, in fast_reboot()
1336 MMU_PAGESIZE, mmu_btop(fb->fb_dest_pa), in fast_reboot()
1341 bcopy((void *)fb_swtch_image, (void *)fb->fb_va, fb->fb_size); in fast_reboot()
1352 if (panicstr && CPU->cpu_id != bootcpuid && in fast_reboot()
1371 * NOTE: If fastreboot_onpanic is set to non-zero in /etc/system,
1372 * new setting passed in via "-B fastreboot_onpanic" is ignored.
1374 * that occur early in boot to utilize Fast Reboot on panic.
1396 * if it's not already set to non-zero, and the value in fastboot_get_bootprop()
1418 * fast reboot, or to reserve low physical memory for fast reboot.
1475 * This is an internal interface to disable Fast Reboot on Panic.
1490 * non-panicking situation must go through fastboot_onpanic_disable().
1499 * This is an internal interface to disable Fast Reboot by Default.
1517 * Fast Reboot by Default and Fast Reboot on Panic.
1519 * General disabling of the Fast Reboot by Default feature should be done
1530 * Returns Fast Reboot not support message for fastreboot_nosup_id.
1532 * Fast Reboot not support message is returned.
1558 * don't try to fast reboot after dumping. in fastboot_update_and_load()