SHA256
1
0
forked from pool/grub2
grub2/0005-i386-fix-TSC-calibration-using-PIT.patch
Marcus Meissner 3ded5cdd6f Accepting request 355366 from home:michael-chang:branches:Base:System
- Backport upstream patches for HyperV gen2 TSC timer calbration without
  RTC (bsc#904647)
  * added 0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch
  * added 0002-i386-tsc-Fix-unused-function-warning-on-xen.patch
  * added 0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch
  * added 0004-tsc-Use-alternative-delay-sources-whenever-appropria.patch
  * added 0005-i386-fix-TSC-calibration-using-PIT.patch

OBS-URL: https://build.opensuse.org/request/show/355366
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=200
2016-01-22 15:15:45 +00:00

28 lines
1.1 KiB
Diff

From a03c1034f6062e69075056c8f31b90e159ce5244 Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Tue, 1 Dec 2015 18:49:38 +0300
Subject: [PATCH] i386: fix TSC calibration using PIT
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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: grub-2.02~beta2/grub-core/kern/i386/tsc_pit.c
===================================================================
--- grub-2.02~beta2.orig/grub-core/kern/i386/tsc_pit.c
+++ grub-2.02~beta2/grub-core/kern/i386/tsc_pit.c
@@ -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);