2 * Etherboot routines for PCBIOS firmware.
4 * Body of routines taken from old pcbios.S
8 #include <gpxe/timer.h>
12 #include <bits/timer2.h>
14 /* A bit faster actually, but we don't care. */
15 #define TIMER2_TICKS_PER_SEC 18
18 * Use direct memory access to BIOS variables, longword 0040:006C (ticks
19 * today) and byte 0040:0070 (midnight crossover flag) instead of calling
20 * timeofday BIOS interrupt.
23 static tick_t bios_currticks ( void ) {
28 /* Re-enable interrupts so that the timer interrupt can occur */
29 __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
34 get_real ( ticks, BDA_SEG, 0x006c );
35 get_real ( midnight, BDA_SEG, 0x0070 );
39 put_real ( midnight, BDA_SEG, 0x0070 );
43 return ( (days + ticks) * (USECS_IN_SEC / TIMER2_TICKS_PER_SEC) );
46 static int bios_ts_init(void)
48 DBG("BIOS timer installed\n");
52 struct timer bios_ts __timer ( 02 ) = {
54 .udelay = i386_timer2_udelay,
55 .currticks = bios_currticks,