]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
i386: fix TSC calibration using PIT
authorMichael Chang <mchang@suse.com>
Tue, 1 Dec 2015 15:49:38 +0000 (18:49 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Tue, 1 Dec 2015 15:49:38 +0000 (18:49 +0300)
Condition was accidentally reversed, so PIT calibration always failed
when PIT was present and always succeeded when PIT was missing, but in
the latter case resulted in absurdly fast clock.

Reported and tested by Vitaly Kuznetsov <vkuznets@redhat.com>

grub-core/kern/i386/tsc_pit.c

index 0c0488c1be0c8c7bffdecafb2f2afd7a746bdcb4..67990bfa6f135f7a0e86aa62c83365feb32db212 100644 (file)
@@ -49,7 +49,7 @@ grub_pit_wait (void)
             | GRUB_PIT_SPK_TMR2,
              GRUB_PIT_SPEAKER_PORT);
 
-  if ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH)) {
+  if ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0x00) {
     ret = 1;
     /* Wait.  */
     while ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0x00);