]> git.sur5r.net Git - u-boot/blobdiff - arch/x86/cpu/cpu.c
patman: Use the full commit hash for 'git checkout'
[u-boot] / arch / x86 / cpu / cpu.c
index 358361970fe427ccfdc2203c7ef56b6020a580cc..b391b7ade47298336bb9042c9b3cbb8f2bebde14 100644 (file)
@@ -25,6 +25,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>
@@ -492,14 +493,14 @@ const char *cpu_vendor_name(int vendor)
        return name;
 }
 
-void fill_processor_name(char *processor_name)
+char *cpu_get_name(char *name)
 {
+       unsigned int *name_as_ints = (unsigned int *)name;
        struct cpuid_result regs;
-       char temp_processor_name[49];
-       char *processor_name_start;
-       unsigned int *name_as_ints = (unsigned int *)temp_processor_name;
+       char *ptr;
        int i;
 
+       /* This bit adds up to 48 bytes */
        for (i = 0; i < 3; i++) {
                regs = cpuid(0x80000002 + i);
                name_as_ints[i * 4 + 0] = regs.eax;
@@ -507,19 +508,17 @@ void fill_processor_name(char *processor_name)
                name_as_ints[i * 4 + 2] = regs.ecx;
                name_as_ints[i * 4 + 3] = regs.edx;
        }
-
-       temp_processor_name[48] = 0;
+       name[CPU_MAX_NAME_LEN - 1] = '\0';
 
        /* Skip leading spaces. */
-       processor_name_start = temp_processor_name;
-       while (*processor_name_start == ' ')
-               processor_name_start++;
+       ptr = name;
+       while (*ptr == ' ')
+               ptr++;
 
-       memset(processor_name, 0, 49);
-       strcpy(processor_name, processor_name_start);
+       return ptr;
 }
 
-int print_cpuinfo(void)
+int default_print_cpuinfo(void)
 {
        printf("CPU: %s, vendor %s, device %xh\n",
               cpu_has_64bit() ? "x86_64" : "x86",
@@ -569,3 +568,26 @@ int cpu_jump_to_64bit(ulong setup_base, ulong target)
 
        return -EFAULT;
 }
+
+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);
+}