nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0253-Use-TSC-as-a-possible-time-source-on-i386-ieee1275.patch

f96e0b
From 983f68a83a2200719a45c0974bb0505431904da5 Mon Sep 17 00:00:00 2001
f96e0b
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
f96e0b
Date: Thu, 4 Apr 2013 09:55:44 +0200
f96e0b
Subject: [PATCH 253/482] 	Use TSC as a possible time source on
f96e0b
 i386-ieee1275.
f96e0b
f96e0b
---
f96e0b
 ChangeLog                      |  4 ++++
f96e0b
 grub-core/Makefile.core.def    |  8 ++------
f96e0b
 grub-core/kern/ieee1275/init.c | 15 ++++++++++-----
f96e0b
 3 files changed, 16 insertions(+), 11 deletions(-)
f96e0b
f96e0b
diff --git a/ChangeLog b/ChangeLog
f96e0b
index 7bbcffa..bd9e903 100644
f96e0b
--- a/ChangeLog
f96e0b
+++ b/ChangeLog
f96e0b
@@ -1,5 +1,9 @@
f96e0b
 2013-04-04  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
 
f96e0b
+	Use TSC as a possible time source on i386-ieee1275.
f96e0b
+
f96e0b
+2013-04-04  Vladimir Serbinenko  <phcoder@gmail.com>
f96e0b
+
f96e0b
 	* grub-core/bus/usb/usbtrans.c (grub_usb_bulk_readwrite_packetize):
f96e0b
 	Init err.
f96e0b
 
f96e0b
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
f96e0b
index 911754d..4b4c024 100644
f96e0b
--- a/grub-core/Makefile.core.def
f96e0b
+++ b/grub-core/Makefile.core.def
f96e0b
@@ -128,11 +128,11 @@ kernel = {
f96e0b
   efi = kern/efi/mm.c;
f96e0b
   efi = term/efi/console.c;
f96e0b
 
f96e0b
-  i386_efi = kern/i386/tsc.c;
f96e0b
+  x86 = kern/i386/tsc.c;
f96e0b
+
f96e0b
   i386_efi = kern/i386/efi/init.c;
f96e0b
   i386_efi = bus/pci.c;
f96e0b
 
f96e0b
-  x86_64_efi = kern/i386/tsc.c;
f96e0b
   x86_64_efi = kern/x86_64/dl.c;
f96e0b
   x86_64_efi = kern/x86_64/efi/callwrap.S;
f96e0b
   x86_64_efi = kern/i386/efi/init.c;
f96e0b
@@ -145,19 +145,15 @@ kernel = {
f96e0b
 
f96e0b
   i386_pc = kern/i386/pc/init.c;
f96e0b
   i386_pc = kern/i386/pc/mmap.c;
f96e0b
-  i386_pc = kern/i386/tsc.c;
f96e0b
   i386_pc = term/i386/pc/console.c;
f96e0b
 
f96e0b
   i386_qemu = bus/pci.c;
f96e0b
   i386_qemu = kern/vga_init.c;
f96e0b
   i386_qemu = kern/i386/qemu/mmap.c;
f96e0b
-  i386_qemu = kern/i386/tsc.c;
f96e0b
 
f96e0b
   i386_coreboot = kern/i386/coreboot/mmap.c;
f96e0b
-  i386_coreboot = kern/i386/tsc.c;
f96e0b
 
f96e0b
   i386_multiboot = kern/i386/multiboot_mmap.c;
f96e0b
-  i386_multiboot = kern/i386/tsc.c;
f96e0b
 
f96e0b
   mips = kern/mips/cache.S;
f96e0b
   mips = kern/mips/dl.c;
f96e0b
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
f96e0b
index 0894cb6..391a734 100644
f96e0b
--- a/grub-core/kern/ieee1275/init.c
f96e0b
+++ b/grub-core/kern/ieee1275/init.c
f96e0b
@@ -34,6 +34,9 @@
f96e0b
 #include <grub/net.h>
f96e0b
 #include <grub/offsets.h>
f96e0b
 #include <grub/memory.h>
f96e0b
+#ifdef __i386__
f96e0b
+#include <grub/cpu/tsc.h>
f96e0b
+#endif
f96e0b
 #ifdef __sparc__
f96e0b
 #include <grub/machine/kernel.h>
f96e0b
 #endif
f96e0b
@@ -269,8 +272,6 @@ grub_parse_cmdline (void)
f96e0b
     }
f96e0b
 }
f96e0b
 
f96e0b
-static grub_uint64_t ieee1275_get_time_ms (void);
f96e0b
-
f96e0b
 grub_addr_t grub_modbase;
f96e0b
 
f96e0b
 void
f96e0b
@@ -288,7 +289,11 @@ grub_machine_init (void)
f96e0b
 
f96e0b
   grub_parse_cmdline ();
f96e0b
 
f96e0b
-  grub_install_get_time_ms (ieee1275_get_time_ms);
f96e0b
+#ifdef __i386__
f96e0b
+  grub_tsc_init ();
f96e0b
+#else
f96e0b
+  grub_install_get_time_ms (grub_rtc_get_time_ms);
f96e0b
+#endif
f96e0b
 }
f96e0b
 
f96e0b
 void
f96e0b
@@ -298,8 +303,8 @@ grub_machine_fini (void)
f96e0b
   grub_console_fini ();
f96e0b
 }
f96e0b
 
f96e0b
-static grub_uint64_t
f96e0b
-ieee1275_get_time_ms (void)
f96e0b
+grub_uint64_t
f96e0b
+grub_rtc_get_time_ms (void)
f96e0b
 {
f96e0b
   grub_uint32_t msecs = 0;
f96e0b
 
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b