From 348c7214f5f9fd58c5f346615f3c07314e623aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 16 Dec 2005 11:55:01 +0000 Subject: [PATCH] Improved processor identification for some VIA C3 models. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15558 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/kernel/OS.h | 6 ++++-- headers/private/shared/cpu_type.h | 34 ++++++++++++++++++++---------- src/apps/abouthaiku/AboutHaiku.cpp | 2 +- src/bin/sysinfo.c | 2 +- 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/headers/os/kernel/OS.h b/headers/os/kernel/OS.h index 51bf5f5a4e..ebc77ffa7b 100644 --- a/headers/os/kernel/OS.h +++ b/headers/os/kernel/OS.h @@ -477,8 +477,10 @@ typedef enum cpu_types { B_CPU_IDT_WINCHIP_C6 = 0x1354, B_CPU_IDT_WINCHIP_2 = 0x1358, B_CPU_IDT_WINCHIP_3, - B_CPU_VIA_EDEN = 0x1367, - B_CPU_VIA_EDEN_EZRA_T = 0x1368, + B_CPU_VIA_C3_SAMUEL = 0x1366, + B_CPU_VIA_C3_SAMUEL_2 = 0x1367, + B_CPU_VIA_C3_EZRA_T = 0x1368, + B_CPU_VIA_C3_NEHEMIAH = 0x1369, /* Transmeta */ B_CPU_TRANSMETA_x86 = 0x1600, diff --git a/headers/private/shared/cpu_type.h b/headers/private/shared/cpu_type.h index 0b7071fad3..ac45c7994d 100644 --- a/headers/private/shared/cpu_type.h +++ b/headers/private/shared/cpu_type.h @@ -16,8 +16,9 @@ extern "C" { #endif const char *get_cpu_vendor_string(enum cpu_types type); -const char *get_cpu_model_string(enum cpu_types type); -void get_cpu_type(char *vendorBuffer, size_t vendorSize, char *modelBuffer, size_t modelSize); +const char *get_cpu_model_string(system_info *info); +void get_cpu_type(char *vendorBuffer, size_t vendorSize, + char *modelBuffer, size_t modelSize); int32 get_rounded_cpu_speed(void); #ifdef __cplusplus @@ -59,10 +60,10 @@ get_cpu_vendor_string(enum cpu_types type) const char * -get_cpu_model_string(enum cpu_types type) +get_cpu_model_string(system_info *info) { // Determine CPU type - switch (type) { + switch (info->cpu_type) { #if __POWERPC__ case B_CPU_PPC_603: return "603"; @@ -156,9 +157,20 @@ get_cpu_model_string(enum cpu_types type) return "WinChip C6"; case B_CPU_IDT_WINCHIP_2: return "WinChip 2"; - case B_CPU_VIA_EDEN: - case B_CPU_VIA_EDEN_EZRA_T: - return "Eden"; + case B_CPU_VIA_C3_SAMUEL: + return "C3 Samuel"; + case B_CPU_VIA_C3_SAMUEL_2: + // stepping identified the model + if ((info->cpu_revision & 0xf) < 8) + return "C3 Eden/Samuel 2"; + return "C3 Ezra"; + case B_CPU_VIA_C3_EZRA_T: + return "C3 Ezra-T"; + case B_CPU_VIA_C3_NEHEMIAH: + // stepping identified the model + if ((info->cpu_revision & 0xf) < 8) + return "C3 Nehemiah"; + return "C3 Eden-N"; /* Cyrix/VIA */ case B_CPU_CYRIX_GXm: @@ -193,7 +205,7 @@ get_cpu_type(char *vendorBuffer, size_t vendorSize, char *modelBuffer, size_t mo if (vendor == NULL) vendor = "Unknown"; - model = get_cpu_model_string(info.cpu_type); + model = get_cpu_model_string(&info); if (model == NULL) model = "Unknown"; @@ -212,14 +224,14 @@ get_cpu_type(char *vendorBuffer, size_t vendorSize, char *modelBuffer, size_t mo int32 get_rounded_cpu_speed(void) { - system_info sys_info; + system_info info; int target, frac, delta; int freqs[] = { 100, 50, 25, 75, 33, 67, 20, 40, 60, 80, 10, 30, 70, 90 }; uint x; - get_system_info(&sys_info); - target = sys_info.cpu_clock_speed / 1000000; + get_system_info(&info); + target = info.cpu_clock_speed / 1000000; frac = target % 100; delta = -frac; diff --git a/src/apps/abouthaiku/AboutHaiku.cpp b/src/apps/abouthaiku/AboutHaiku.cpp index 328ac4c5d7..763775ebc1 100644 --- a/src/apps/abouthaiku/AboutHaiku.cpp +++ b/src/apps/abouthaiku/AboutHaiku.cpp @@ -196,7 +196,7 @@ AboutView::AboutView(const BRect &rect) BString cpuType; cpuType << get_cpu_vendor_string(systemInfo.cpu_type) - << " " << get_cpu_model_string(systemInfo.cpu_type); + << " " << get_cpu_model_string(&systemInfo); r.OffsetBy(0, labelHeight); r.bottom = r.top + textHeight; diff --git a/src/bin/sysinfo.c b/src/bin/sysinfo.c index b2cd7e8e67..cd49d521e0 100644 --- a/src/bin/sysinfo.c +++ b/src/bin/sysinfo.c @@ -494,7 +494,7 @@ static void dump_cpus(system_info *info) { const char *vendor = get_cpu_vendor_string(info->cpu_type); - const char *model = get_cpu_model_string(info->cpu_type); + const char *model = get_cpu_model_string(info); int32 cpu; if (model == NULL && vendor == NULL)