[U-Boot] [PATCH 37/39] x86: Make show_boot_progress() common

Simon Glass sjg at chromium.org
Thu Nov 6 21:20:29 CET 2014


This function can probably be used on all x86 boards, so move it into the
common file.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 arch/x86/cpu/coreboot/coreboot.c | 24 ------------------------
 arch/x86/cpu/cpu.c               | 24 ++++++++++++++++++++++++
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c
index 41c3936..8295b0e 100644
--- a/arch/x86/cpu/coreboot/coreboot.c
+++ b/arch/x86/cpu/coreboot/coreboot.c
@@ -15,7 +15,6 @@
 #include <asm/cache.h>
 #include <asm/cpu.h>
 #include <asm/io.h>
-#include <asm/post.h>
 #include <asm/arch/tables.h>
 #include <asm/arch/sysinfo.h>
 #include <asm/arch/timestamp.h>
@@ -49,29 +48,6 @@ int board_early_init_r(void)
 	return 0;
 }
 
-void show_boot_progress(int val)
-{
-#if MIN_PORT80_KCLOCKS_DELAY
-	/*
-	 * Scale the time counter reading to avoid using 64 bit arithmetics.
-	 * Can't use get_timer() here becuase it could be not yet
-	 * initialized or even implemented.
-	 */
-	if (!gd->arch.tsc_prev) {
-		gd->arch.tsc_base_kclocks = rdtsc() / 1000;
-		gd->arch.tsc_prev = 0;
-	} else {
-		uint32_t now;
-
-		do {
-			now = rdtsc() / 1000 - gd->arch.tsc_base_kclocks;
-		} while (now < (gd->arch.tsc_prev + MIN_PORT80_KCLOCKS_DELAY));
-		gd->arch.tsc_prev = now;
-	}
-#endif
-	outb(val, POST_PORT);
-}
-
 int last_stage_init(void)
 {
 	if (gd->flags & GD_FLG_COLD_BOOT)
diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index 61c198e..7ab2570 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -22,6 +22,7 @@
 #include <malloc.h>
 #include <asm/control_regs.h>
 #include <asm/cpu.h>
+#include <asm/post.h>
 #include <asm/processor.h>
 #include <asm/processor-flags.h>
 #include <asm/interrupt.h>
@@ -400,3 +401,26 @@ char *cpu_get_name(char *name)
 
 	return ptr;
 }
+
+void show_boot_progress(int val)
+{
+#if MIN_PORT80_KCLOCKS_DELAY
+	/*
+	 * Scale the time counter reading to avoid using 64 bit arithmetics.
+	 * Can't use get_timer() here becuase it could be not yet
+	 * initialized or even implemented.
+	 */
+	if (!gd->arch.tsc_prev) {
+		gd->arch.tsc_base_kclocks = rdtsc() / 1000;
+		gd->arch.tsc_prev = 0;
+	} else {
+		uint32_t now;
+
+		do {
+			now = rdtsc() / 1000 - gd->arch.tsc_base_kclocks;
+		} while (now < (gd->arch.tsc_prev + MIN_PORT80_KCLOCKS_DELAY));
+		gd->arch.tsc_prev = now;
+	}
+#endif
+	outb(val, POST_PORT);
+}
-- 
2.1.0.rc2.206.gedb03e5



More information about the U-Boot mailing list