// Main setup code. static void maininit(void) { // Initialize internal interfaces. interface_init(); // Setup platform devices. platform_hardware_setup(); // call a payload if (CONFIG_RUN_PAYLOAD) { dprintf(1, "Looking for payload %s\n", CONFIG_RUN_PAYLOAD_FILE); struct romfile_s *file = NULL; file = romfile_find( CONFIG_RUN_PAYLOAD_FILE ); if (!file) printf("Could not find payload\n"); else { struct cbfs_romfile_s *cfile; cfile = container_of(file, struct cbfs_romfile_s, file); cbfs_run_payload(cfile->fhdr); } } // Start hardware initialization (if optionrom threading) if (CONFIG_THREAD_OPTIONROMS) device_hardware_setup(); // Run vga option rom vgarom_setup(); // Do hardware initialization (if running synchronously) if (!CONFIG_THREAD_OPTIONROMS) { device_hardware_setup(); wait_threads(); } // Run option roms optionrom_setup(); // show system info before the F12 menu if (CONFIG_DISPLAY_SYSTEM_INFO) dprintf(1, "\nBuild date: %s\n", __DATE__); // Allow user to modify overall boot order. interactive_bootmenu(); wait_threads(); // Prepare for boot. prepareboot(); // Write protect bios memory. make_bios_readonly(); // Invoke int 19 to start boot process. startBoot(); }
// Main setup code. static void maininit(void) { // Initialize internal interfaces. interface_init(); // Setup platform devices. platform_hardware_setup(); // Start hardware initialization (if threads allowed during optionroms) if (threads_during_optionroms()) device_hardware_setup(); // Run vga option rom vgarom_setup(); sercon_setup(); enable_vga_console(); // Do hardware initialization (if running synchronously) if (!threads_during_optionroms()) { device_hardware_setup(); wait_threads(); } // Run option roms optionrom_setup(); // Allow user to modify overall boot order. interactive_bootmenu(); wait_threads(); // Prepare for boot. prepareboot(); // Write protect bios memory. make_bios_readonly(); // Invoke int 19 to start boot process. startBoot(); }
/* PrepareToBoot */ static void handle_csm_0002(struct bregs *regs) { if (!CONFIG_BOOT) { regs->ax = 1; return; } dprintf(3, "PrepareToBoot table %04x:%04x\n", regs->es, regs->bx); struct e820entry *p = (void *)csm_compat_table.E820Pointer; int i; for (i=0; i < csm_compat_table.E820Length / sizeof(struct e820entry); i++) e820_add(p[i].start, p[i].size, p[i].type); if (csm_init_table->HiPmmMemorySizeInBytes > BUILD_MAX_HIGHTABLE) { u32 hi_pmm_end = csm_init_table->HiPmmMemory + csm_init_table->HiPmmMemorySizeInBytes; e820_add(hi_pmm_end - BUILD_MAX_HIGHTABLE, BUILD_MAX_HIGHTABLE, E820_RESERVED); } // For PCIBIOS 1ab10e if (csm_compat_table.IrqRoutingTablePointer && csm_compat_table.IrqRoutingTableLength) { PirAddr = (void *)csm_compat_table.IrqRoutingTablePointer; dprintf(3, "CSM PIRQ table at %p\n", PirAddr); } // For find_resume_vector()... and find_acpi_features() if (csm_rsdp.signature == RSDP_SIGNATURE) { RsdpAddr = &csm_rsdp; dprintf(3, "CSM ACPI RSDP at %p\n", RsdpAddr); find_acpi_features(); } // SMBIOS table needs to be copied into the f-seg // XX: OVMF doesn't seem to set SmbiosTableLength so don't check it if (csm_boot_table->SmbiosTable && !SMBiosAddr) copy_smbios((void *)csm_boot_table->SmbiosTable); // MPTABLE is just there; we don't care where. // EFI may have reinitialised the video using its *own* driver. enable_vga_console(); // EFI fills this in for us. Zero it for now... struct bios_data_area_s *bda = MAKE_FLATPTR(SEG_BDA, 0); bda->hdcount = 0; thread_setup(); mathcp_setup(); timer_setup(); clock_setup(); device_hardware_setup(); wait_threads(); interactive_bootmenu(); prepareboot(); regs->ax = 0; }