Lines Matching refs:nk

271 fastboot_vatoindex(fastboot_info_t *nk, uintptr_t va, int level)
273 return ((va >> nk->fi_shift_amt[level]) & (nk->fi_ptes_per_table - 1));
282 fastboot_map_with_size(fastboot_info_t *nk, uintptr_t vstart, paddr_t pstart,
290 table = (x86pte_t *)(nk->fi_pagetable_va);
292 for (l = nk->fi_top_level; l >= level; l--) {
294 index = fastboot_vatoindex(nk, vstart, l);
302 vaddr += (1ULL << nk->fi_shift_amt[l]),
303 paddr += (1ULL << nk->fi_shift_amt[l])) {
305 uint_t index = fastboot_vatoindex(nk, vaddr, l);
318 - nk->fi_pagetable_pa) + nk->fi_pagetable_va);
324 if (l == nk->fi_top_level) {
326 ASSERT(nk->fi_top_level == 3);
327 table[index] = nk->fi_next_table_pa | ptp_bits;
329 table[index] = nk->fi_next_table_pa | PT_VALID;
332 table[index] = nk->fi_next_table_pa | ptp_bits;
334 table = (x86pte_t *)(nk->fi_next_table_va);
335 nk->fi_next_table_va += MMU_PAGESIZE;
336 nk->fi_next_table_pa += MMU_PAGESIZE;
347 fastboot_build_pagetables(fastboot_info_t *nk)
352 fastboot_map_with_size(nk, 0, 0, ONE_GIG, 1);
357 fake_va = P2ALIGN_TYPED(fake_va, nk->fi_lpagesize, uintptr_t);
358 fastboot_map_with_size(nk, fake_va,
359 nk->fi_files[0].fb_pte_list_va[0] & MMU_PAGEMASK, PAGESIZE, 0);
463 fastboot_build_mbi(char *mdep, fastboot_info_t *nk)
492 if (nk->fi_mbi_size && nk->fi_mbi_size < size) {
493 contig_free((void *)nk->fi_new_mbi_va, nk->fi_mbi_size);
494 nk->fi_mbi_size = 0;
497 if (nk->fi_mbi_size == 0) {
498 if ((nk->fi_new_mbi_va =
509 nk->fi_mbi_size = size;
515 bzero((void *)nk->fi_new_mbi_va, nk->fi_mbi_size);
520 start_addr_va = nk->fi_new_mbi_va;
523 nk->fi_new_mbi_pa = (paddr_t)start_addr_pa;
543 mbp->mod_start = nk->fi_files[FASTBOOT_BOOTARCHIVE].fb_dest_pa;
544 mbp->mod_end = nk->fi_files[FASTBOOT_BOOTARCHIVE].fb_next_pa;
601 fastboot_init_fields(fastboot_info_t *nk)
604 nk->fi_has_pae = 1;
605 nk->fi_shift_amt = fastboot_shift_amt_pae;
606 nk->fi_ptes_per_table = 512;
607 nk->fi_lpagesize = (2 << 20); /* 2M */
609 nk->fi_top_level = 3;
611 nk->fi_top_level = 2;
676 fastboot_reserve_mem(fastboot_info_t *nk)
683 if (nk->fi_valid)
690 fastboot_file_t *fb = &nk->fi_files[i];
706 if ((nk->fi_pagetable_va =
711 nk->fi_pagetable_size = fastboot_pagetable_size;
716 if ((nk->fi_new_mbi_va = (uintptr_t)contig_alloc(fastboot_mbi_size,
720 nk->fi_mbi_size = fastboot_mbi_size;
772 fastboot_free_mem(fastboot_info_t *nk, uint64_t endaddr)
777 fastboot_free_file(nk->fi_files + i);
778 fastboot_free_file_pte(nk->fi_files + i, endaddr);
781 if (nk->fi_pagetable_size && nk->fi_pagetable_pa < endaddr) {
782 contig_free((void *)nk->fi_pagetable_va, nk->fi_pagetable_size);
783 nk->fi_pagetable_va = 0;
784 nk->fi_pagetable_pa = 0;
785 nk->fi_pagetable_size = 0;
788 if (nk->fi_mbi_size && nk->fi_new_mbi_pa < endaddr) {
789 contig_free((void *)nk->fi_new_mbi_va, nk->fi_mbi_size);
790 nk->fi_new_mbi_va = 0;
791 nk->fi_new_mbi_pa = 0;
792 nk->fi_mbi_size = 0;
801 fastboot_free_newkernel(fastboot_info_t *nk)
805 nk->fi_valid = 0;
810 fastboot_free_file(&(nk->fi_files[i]));
815 fastboot_cksum_cdata(fastboot_info_t *nk, uchar_t *md5_hash)
822 MD5Update(&md5_ctx, nk->fi_files[i].fb_pte_list_va,
823 nk->fi_files[i].fb_pte_list_size);
825 MD5Update(&md5_ctx, (void *)nk->fi_pagetable_va, nk->fi_pagetable_size);
826 MD5Update(&md5_ctx, (void *)nk->fi_new_mbi_va, nk->fi_mbi_size);
835 fastboot_cksum_generate(fastboot_info_t *nk)
840 fastboot_cksum_file(nk->fi_files + i, nk->fi_md5_hash[i]);
842 fastboot_cksum_cdata(nk, nk->fi_md5_hash[i]);
850 fastboot_cksum_verify(fastboot_info_t *nk)
856 fastboot_cksum_file(nk->fi_files + i, md5_hash);
857 if (bcmp(nk->fi_md5_hash[i], md5_hash,
858 sizeof (nk->fi_md5_hash[i])) != 0)
862 fastboot_cksum_cdata(nk, md5_hash);
863 if (bcmp(nk->fi_md5_hash[i], md5_hash,
864 sizeof (nk->fi_md5_hash[i])) != 0)
1296 fastboot_xc_func(fastboot_info_t *nk, xc_arg_t unused2, xc_arg_t unused3)
1299 fastboot_file_t *fb = &nk->fi_files[FASTBOOT_SWTCH];
1322 (*fastboot_func)(nk);