diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2010-05-01 12:20:33 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2010-05-01 12:20:33 -0400 |
commit | e438b0c6202ab7e2c55f4e9bf4db0bc176e5c544 (patch) | |
tree | a498cf1b7a289d7de220887a5917b5f528bccaa7 | |
parent | f59b5ac27eec5a8bf3e2804bf57385b8c2b0fd06 (diff) | |
download | seabios-e438b0c6202ab7e2c55f4e9bf4db0bc176e5c544.tar.gz |
Further parallelize init when using CONFIG_THREAD_OPTIONROMS.
When optionrom threading is enabled, allow hardware init to run in
parallel with boot menu key press delay and with the smp detection.
Also, run qemu_cfg_port_probe() before ram_probe().
-rw-r--r-- | src/boot.c | 6 | ||||
-rw-r--r-- | src/post.c | 64 | ||||
-rw-r--r-- | src/stacks.c | 4 | ||||
-rw-r--r-- | src/util.c | 6 |
4 files changed, 50 insertions, 30 deletions
@@ -236,6 +236,7 @@ interactive_bootmenu(void) ; printf("Select boot device:\n\n"); + wait_threads(); int subcount[ARRAY_SIZE(IPL.bev)]; int menupos = 1; @@ -306,13 +307,16 @@ run_bcv(struct ipl_entry_s *ie) void boot_prep(void) { - if (! CONFIG_BOOT) + if (! CONFIG_BOOT) { + wait_threads(); return; + } // XXX - show available drives? // Allow user to modify BCV/IPL order. interactive_bootmenu(); + wait_threads(); // Setup floppy boot order int override = IPL.bev[0].subchoice; @@ -172,6 +172,20 @@ init_bios_tables(void) acpi_bios_init(); } +// Initialize hardware devices +static void +init_hw(void) +{ + usb_setup(); + ps2port_setup(); + lpt_setup(); + serial_setup(); + + floppy_setup(); + ata_setup(); + ramdisk_setup(); +} + // Main setup code. static void post(void) @@ -180,6 +194,7 @@ post(void) init_ivt(); init_bda(); memmap_setup(); + qemu_cfg_port_probe(); ram_probe(); malloc_setup(); thread_setup(); @@ -189,16 +204,26 @@ post(void) timer_setup(); mathcp_setup(); - // Initialize smp - qemu_cfg_port_probe(); + // Initialize mtrr smp_probe_setup(); mtrr_setup(); - smp_probe(); // Initialize pci pci_setup(); smm_init(); + // Initialize internal tables + boot_setup(); + drive_setup(); + cdemu_setup(); + + // Start hardware initialization (if optionrom threading) + if (CONFIG_THREADS && CONFIG_THREAD_OPTIONROMS) + init_hw(); + + // Find and initialize other cpus + smp_probe(); + // Setup interfaces that option roms may need bios32_setup(); pmm_setup(); @@ -207,35 +232,18 @@ post(void) mouse_setup(); init_bios_tables(); - // Run vga option rom (if running synchronously) - if (!CONFIG_THREADS || !CONFIG_THREAD_OPTIONROMS) - vga_setup(); - - // Initialize hardware devices - usb_setup(); - ps2port_setup(); - lpt_setup(); - serial_setup(); + // Run vga option rom + vga_setup(); - boot_setup(); - drive_setup(); - cdemu_setup(); - floppy_setup(); - ata_setup(); - ramdisk_setup(); - - // Run option roms - if (CONFIG_THREADS && CONFIG_THREAD_OPTIONROMS) { - // Run option roms while hw init still in progress. - vga_setup(); - optionrom_setup(); + // Do hardware initialization (if running synchronously) + if (!CONFIG_THREADS || !CONFIG_THREAD_OPTIONROMS) { + init_hw(); wait_threads(); - } else { - // Wait for hw init to finish and run non-vga option roms. - wait_threads(); - optionrom_setup(); } + // Run option roms + optionrom_setup(); + // Run BCVs and show optional boot menu boot_prep(); diff --git a/src/stacks.c b/src/stacks.c index 92d91a06..859de3f5 100644 --- a/src/stacks.c +++ b/src/stacks.c @@ -193,6 +193,8 @@ __end_thread(struct thread_info *old) *old->pprev = old->next; free(old); dprintf(DEBUG_thread, "\\%08x/ End thread\n", (u32)old); + if (MainThread.next == &MainThread) + dprintf(1, "All threads complete.\n"); } // Create a new thread and start executing 'func' in it. @@ -299,7 +301,7 @@ finish_preempt(void) } CanPreempt = 0; releaseRTC(); - dprintf(1, "Done preempt - %d checks\n", PreemptCount); + dprintf(9, "Done preempt - %d checks\n", PreemptCount); yield(); } @@ -294,7 +294,9 @@ check_for_keystroke(void) memset(&br, 0, sizeof(br)); br.flags = F_IF; br.ah = 1; + start_preempt(); call16_int(0x16, &br); + finish_preempt(); return !(br.flags & F_ZF); } @@ -305,7 +307,9 @@ get_raw_keystroke(void) struct bregs br; memset(&br, 0, sizeof(br)); br.flags = F_IF; + start_preempt(); call16_int(0x16, &br); + finish_preempt(); return br.ah; } @@ -318,7 +322,9 @@ get_keystroke(int msec) return get_raw_keystroke(); if (msec <= 0) return -1; + start_preempt(); biosusleep(50*1000); + finish_preempt(); msec -= 50; } } |