Lines Matching refs:cfg

212 page_table_set_attr(struct config *cfg, uint64_t start, uint64_t end, uint64_t attr) {
222 &cfg->tables->L1_tables[table_number][table_index];
232 build_page_tables(struct config *cfg) {
244 cfg->tables = &page_tables;
266 (EFI_PHYSICAL_ADDRESS *)&cfg->tables->L0_table
272 memset(cfg->tables->L0_table, 0, BASE_PAGE_SIZE);
276 cfg->tables->nL1 = 0;
282 cfg->tables->nL1++;
284 ASSERT(cfg->tables->nL1 <= MAX_L1_TABLES)
290 Print(L"Allocating %d L1 tables (%dB)\n", cfg->tables->nL1, cfg->tables->nL1 * BASE_PAGE_SIZE);
295 cfg->tables->nL1,
302 memset((void *)L1_memory, 0, cfg->tables->nL1 * BASE_PAGE_SIZE);
305 for (size_t i = 0; i < cfg->tables->nL1; i++) {
306 cfg->tables->L1_tables[i] = (union aarch64_descriptor *)(L1_memory + i * BASE_PAGE_SIZE);
310 cfg->tables->L0_table[L0_index].d.base =
311 (uint64_t)cfg->tables->L1_tables[i] >> ARMv8_BASE_PAGE_BITS;
312 cfg->tables->L0_table[L0_index].d.mb1 = 1; /* Page table */
313 cfg->tables->L0_table[L0_index].d.valid = 1;
323 &cfg->tables->L1_tables[table_number][table_index];
349 page_table_set_attr(cfg, desc->PhysicalStart, desc->PhysicalStart + BASE_PAGE_SIZE * desc->NumberOfPages, ATTR_CACHED);
361 &cfg->tables->L1_tables[table_number][table_index];
377 &cfg->tables->L1_tables[table_number][table_index];
386 if (cfg->tables) {
387 if (cfg->tables->L1_tables) {
389 for (i= 0; i < cfg->tables->nL1; i++) {
390 if (cfg->tables->L1_tables[i])
391 BS->FreePages((EFI_PHYSICAL_ADDRESS)cfg->tables->L1_tables[i], 1);
394 if (cfg->tables->L0_table) {
395 BS->FreePages((EFI_PHYSICAL_ADDRESS)cfg->tables->L0_table, 1);
416 relocate_boot_driver(struct Blob *blob_info, struct config *cfg)
446 cfg->boot_driver_entry = boot_driver + blob_info->boot_driver_entry;
452 relocate_cpu_driver(struct Blob *blob_info, struct config *cfg)
482 cfg->cpu_driver_entry = cpu_driver + blob_info->cpu_driver_entry + KERNEL_OFFSET;
488 &cfg->cpu_driver_stack
495 cfg->cpu_driver_stack_size = KERNEL_STACK_SIZE;
499 cfg->cpu_driver_entry,
500 cfg->cpu_driver_stack
507 relocate_modules(struct Blob *blob_info, struct config *cfg)
518 &cfg->modules
525 memcpy((void *)cfg->modules, BLOB_ADDRESS(blob_info->modules), blob_info->modules_size);
530 relocate_multiboot(struct Blob *blob_info, struct config *cfg)
542 (EFI_PHYSICAL_ADDRESS *)&cfg->multiboot
549 memcpy(cfg->multiboot, BLOB_ADDRESS(blob_info->multiboot), blob_info->multiboot_size);
554 uint64_t module_offset = (uint64_t)cfg->modules - blob_info->modules;
556 Print(L"Relocating multiboot info: %lx\n", cfg->multiboot);
559 for (tag = cfg->multiboot->tags; tag->type != MULTIBOOT_TAG_TYPE_EFI_MMAP; tag = (void *)tag + tag->size) {
570 cfg->cmd_tag = (struct multiboot_tag_string *)tag;
575 cfg->mmap_tag = (struct multiboot_tag_efi_mmap *)tag;
581 create_core_data(struct config *cfg)
601 (lpaddr_t)cfg->cpu_driver_stack + cfg->cpu_driver_stack_size - 16;
602 core_data->cpu_driver_stack_limit = (lpaddr_t)cfg->cpu_driver_stack;
603 core_data->cpu_driver_entry = (lvaddr_t)cfg->cpu_driver_entry;
604 core_data->page_table_root = (genpaddr_t)cfg->tables->L0_table;
607 cfg->cmd_tag->string,
609 cfg->cmd_tag->size - sizeof(struct multiboot_tag_string),
614 core_data->multiboot_image.base = (lpaddr_t)cfg->multiboot;
615 core_data->multiboot_image.length = cfg->multiboot->total_size;
616 core_data->efi_mmap = (lpaddr_t)cfg->mmap_tag;
632 struct config cfg;
634 status = relocate_boot_driver(blob_info, &cfg);
640 status = relocate_cpu_driver(blob_info, &cfg);
646 status = relocate_modules(blob_info, &cfg);
652 status = relocate_multiboot(blob_info, &cfg);
658 status = build_page_tables(&cfg);
664 struct armv8_core_data *core_data = create_core_data(&cfg);
666 Print(L"Terminating boot services and jumping to image at 0x%lx\n", cfg.boot_driver_entry);
691 cfg.mmap_tag->size = ROUND_UP(sizeof(struct multiboot_tag_efi_mmap) + mmap_size, 8);
692 cfg.mmap_tag->descr_size = mmap_d_size;
693 cfg.mmap_tag->descr_vers = mmap_d_ver;
694 memcpy(cfg.mmap_tag->efi_mmap, mmap, mmap_size);
696 struct multiboot_tag *end_tag = (void *)cfg.mmap_tag + cfg.mmap_tag->size;
699 cfg.multiboot->total_size = (void *)end_tag + end_tag->size - (void *)cfg.multiboot;
712 (*((boot_driver *) (cfg.boot_driver_entry))) (MULTIBOOT2_BOOTLOADER_MAGIC, core_data);