Jan Atle Ramsli <[EMAIL PROTECTED]> writes:
> Now, the AT HW ref sais that Bit 6-4 in the RTC info, 0x00-0x0d
> controls the time base frequency, defaulting to 010, selcting
> 32.768kHz as default. So, the RTC can be manipulated by
> upsetting these 3 bits.
This could indeed be the problem. I just grepped for
RTC_REF_CLCK in linux-2.2.14 and it seems that the ARM and MIPS
ports reselect the 32kHz clock on every boot but the i386 version
doesn't.
Here's a Hurd program which should write the right value in the
register. I haven't tested it because I can't reboot to the Hurd
right now.
#include <mach/machine/pio.h> /* outb (port, value) */
#include <stdio.h>
int
main (void)
{
unsigned char old;
outb (0x70, 0x0A); /* select RTC register A */
old = inb (0x71); /* read its value */
printf ("Register A was: 0x%02X\n", old);
outb (0x70, 0x0A); /* select RTC register A */
outb (0x71, 0x20); /* write 0x20 to it, selecting the 32kHz clock */
return 0;
}
The above program has a race condition, though: if the kernel or
another process uses the RTC between the outb instructions, the
value gets written to the wrong place and might clobber your hard
disk parameters. But the instructions are short and close to
each other, so hopefully there won't be a task switch between
them. Besides, most BIOSes have an "autodetect disks" button
nowadays. :-)