summaryrefslogtreecommitdiff
path: root/arch/x86/cpu/i386/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/cpu/i386/cpu.c')
-rw-r--r--arch/x86/cpu/i386/cpu.c99
1 files changed, 60 insertions, 39 deletions
diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c
index d837fb97982..a51a24498a7 100644
--- a/arch/x86/cpu/i386/cpu.c
+++ b/arch/x86/cpu/i386/cpu.c
@@ -263,6 +263,49 @@ static int build_vendor_name(char *vendor_name)
}
#endif
+int x86_cpu_vendor_info(char *name)
+{
+ uint cpu_device;
+
+ cpu_device = 0;
+
+ /* gcc 7.3 does not want to drop x86_vendors, so use #ifdef */
+#ifndef CONFIG_TPL_BUILD
+ *name = '\0'; /* Unset */
+
+ /* Find the id and vendor_name */
+ if (!has_cpuid()) {
+ /* Its a 486 if we can modify the AC flag */
+ if (flag_is_changeable_p(X86_EFLAGS_AC))
+ cpu_device = 0x00000400; /* 486 */
+ else
+ cpu_device = 0x00000300; /* 386 */
+ if (cpu_device == 0x00000400 && test_cyrix_52div()) {
+ /* If we ever care we can enable cpuid here */
+ memcpy(name, "CyrixInstead", 13);
+
+ /* Detect NexGen with old hypercode */
+ } else if (deep_magic_nexgen_probe()) {
+ memcpy(name, "NexGenDriven", 13);
+ }
+ } else {
+ int cpuid_level;
+
+ cpuid_level = build_vendor_name(name);
+ name[12] = '\0';
+
+ /* Intel-defined flags: level 0x00000001 */
+ if (cpuid_level >= 0x00000001)
+ cpu_device = cpuid_eax(0x00000001);
+ else
+ /* Have CPUID level 0 only unheard of */
+ cpu_device = 0x00000400;
+ }
+#endif /* CONFIG_TPL_BUILD */
+
+ return cpu_device;
+}
+
static void identify_cpu(struct cpu_device_id *cpu)
{
cpu->device = 0; /* fix gcc 4.4.4 warning */
@@ -289,46 +332,19 @@ static void identify_cpu(struct cpu_device_id *cpu)
return;
}
-/* gcc 7.3 does not want to drop x86_vendors, so use #ifdef */
#ifndef CONFIG_TPL_BUILD
- char vendor_name[16];
- int i;
-
- vendor_name[0] = '\0'; /* Unset */
-
- /* Find the id and vendor_name */
- if (!has_cpuid()) {
- /* Its a 486 if we can modify the AC flag */
- if (flag_is_changeable_p(X86_EFLAGS_AC))
- cpu->device = 0x00000400; /* 486 */
- else
- cpu->device = 0x00000300; /* 386 */
- if ((cpu->device == 0x00000400) && test_cyrix_52div()) {
- memcpy(vendor_name, "CyrixInstead", 13);
- /* If we ever care we can enable cpuid here */
- }
- /* Detect NexGen with old hypercode */
- else if (deep_magic_nexgen_probe())
- memcpy(vendor_name, "NexGenDriven", 13);
- } else {
- int cpuid_level;
-
- cpuid_level = build_vendor_name(vendor_name);
- vendor_name[12] = '\0';
-
- /* Intel-defined flags: level 0x00000001 */
- if (cpuid_level >= 0x00000001) {
- cpu->device = cpuid_eax(0x00000001);
- } else {
- /* Have CPUID level 0 only unheard of */
- cpu->device = 0x00000400;
- }
- }
- cpu->vendor = X86_VENDOR_UNKNOWN;
- for (i = 0; i < ARRAY_SIZE(x86_vendors); i++) {
- if (memcmp(vendor_name, x86_vendors[i].name, 12) == 0) {
- cpu->vendor = x86_vendors[i].vendor;
- break;
+ {
+ char vendor_name[16];
+ int i;
+
+ cpu->device = x86_cpu_vendor_info(vendor_name);
+
+ cpu->vendor = X86_VENDOR_UNKNOWN;
+ for (i = 0; i < ARRAY_SIZE(x86_vendors); i++) {
+ if (memcmp(vendor_name, x86_vendors[i].name, 12) == 0) {
+ cpu->vendor = x86_vendors[i].vendor;
+ break;
+ }
}
}
#endif
@@ -485,6 +501,11 @@ int x86_cpu_reinit_f(void)
return 0;
}
+void x86_get_identity_for_timer(void)
+{
+ setup_identity();
+}
+
void x86_enable_caches(void)
{
unsigned long cr0;