From b29200c51beb1e75e7f844a4093da05b8394ad5e Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Fri, 6 Apr 2012 14:25:09 +0200 Subject: [PATCH] tsc crap :/ --- src/clock.c | 19 +++++++++++++++++++ src/post.c | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/src/clock.c b/src/clock.c index e8a48a1..d88515c 100644 --- a/src/clock.c +++ b/src/clock.c @@ -81,6 +81,7 @@ calibrate_tsc(void) } // Setup "timer2" +#if 0 u8 orig = inb(PORT_PS2_CTRLB); outb((orig & ~PPCB_SPKR) | PPCB_T2GATE, PORT_PS2_CTRLB); /* binary, mode 0, LSB/MSB, Ch 2 */ @@ -104,6 +105,10 @@ calibrate_tsc(void) , (u32)start, (u32)end, (u32)diff); u32 hz = diff * PIT_TICK_RATE / CALIBRATE_COUNT; SET_GLOBAL(cpu_khz, hz / 1000); +#else + u32 hz = 800 * 1000000; + SET_GLOBAL(cpu_khz, hz / 1000); +#endif dprintf(1, "CPU Mhz=%u\n", hz / 1000000); } @@ -252,20 +257,34 @@ void timer_setup(void) { dprintf(3, "init timer\n"); +#if 1 calibrate_tsc(); +#endif + dprintf(3, "init timer: 01\n"); pit_setup(); + dprintf(3, "init timer: 02\n"); init_rtc(); + dprintf(3, "init timer: 03\n"); rtc_updating(); + dprintf(3, "init timer: 04\n"); u32 seconds = bcd2bin(inb_cmos(CMOS_RTC_SECONDS)); + dprintf(3, "init timer: 05\n"); u32 minutes = bcd2bin(inb_cmos(CMOS_RTC_MINUTES)); + dprintf(3, "init timer: 06\n"); u32 hours = bcd2bin(inb_cmos(CMOS_RTC_HOURS)); + dprintf(3, "init timer: 07\n"); u32 ticks = (hours * 60 + minutes) * 60 + seconds; + dprintf(3, "init timer: 08\n"); ticks = ((u64)ticks * PIT_TICK_RATE) / PIT_TICK_INTERVAL; + dprintf(3, "init timer: 09\n"); SET_BDA(timer_counter, ticks); + dprintf(3, "init timer: 10\n"); enable_hwirq(0, FUNC16(entry_08)); + dprintf(3, "init timer: 11\n"); enable_hwirq(8, FUNC16(entry_70)); + dprintf(3, "init timer: 12\n"); } diff --git a/src/post.c b/src/post.c index b4ad1fa..7c76959 100644 --- a/src/post.c +++ b/src/post.c @@ -244,13 +244,19 @@ maininit(void) // Setup interfaces that option roms may need bios32_setup(); + dprintf(3, "[wurm] pmm_setup\n"); pmm_setup(); + dprintf(3, "[wurm] pnp_setup\n"); pnp_setup(); + dprintf(3, "[wurm] kbd_setup\n"); kbd_setup(); + dprintf(3, "[wurm] mouse_setup\n"); mouse_setup(); + dprintf(3, "[wurm] init_bios_tables\n"); init_bios_tables(); // Run vga option rom + dprintf(3, "[wurm] vga_setup\n"); vga_setup(); // Do hardware initialization (if running synchronously) -- 2.25.1