1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2025-10-03 11:01:30 +00:00

Modified the test-stash and the testing code, so that it is aware of the SSE unit size functionality. Also, added support for detecting AMD Llano/Brazos CPUs

git-svn-id: https://svn.code.sf.net/p/libcpuid/code/HEAD/libcpuid@98 3b4be424-7ac5-41d7-8526-f4ddcb85d872
This commit is contained in:
Veselin Georgiev 2011-10-11 17:26:00 +00:00
commit 42fc8b4654
3 changed files with 78 additions and 4 deletions

View file

@ -63,6 +63,10 @@ enum _amd_code_t {
ATHLON_64_X2,
ATHLON_64_X3,
ATHLON_64_X4,
FUSION_C,
FUSION_E,
FUSION_EA,
FUSION_Z,
};
typedef enum _amd_code_t amd_code_t;
@ -237,6 +241,16 @@ const struct match_entry_t cpudb_amd[] = {
{ 15, 4, -1, 16, -1, 2, 512, -1, ATHLON_64_X2 , 0, "Athlon II X2 (Regor)" },
{ 15, 5, -1, 16, 5, 3, 512, -1, ATHLON_64_X3 , 0, "Athlon II X3 (Rana)" },
{ 15, 5, -1, 16, 5, 4, 512, -1, ATHLON_64_X4 , 0, "Athlon II X4 (Propus)" },
/* 2011 CPUs with AMD fusion: */
{ 15, -1, -1, 20, 1, 1, 512, -1, FUSION_C , 0, "Brazos Ontario" },
{ 15, -1, -1, 20, 1, 2, 512, -1, FUSION_C , 0, "Brazos Ontario (Dual-core)" },
{ 15, -1, -1, 20, 1, 1, 512, -1, FUSION_E , 0, "Brazos Zacate" },
{ 15, -1, -1, 20, 1, 2, 512, -1, FUSION_E , 0, "Brazos Zacate (Dual-core)" },
{ 15, -1, -1, 20, 1, 1, 512, -1, FUSION_Z , 0, "Brazos Desna" },
{ 15, -1, -1, 18, 2, 1, 512, -1, FUSION_EA , 0, "Llano X2" },
{ 15, -1, -1, 18, 2, 1, 1024, -1, FUSION_EA , 0, "Llano X2" },
{ 15, -1, -1, 18, 3, 1, 1024, -1, FUSION_EA , 0, "Llano X3" },
{ 15, -1, -1, 18, 4, 1, 1024, -1, FUSION_EA , 0, "Llano X4" },
};
@ -275,13 +289,13 @@ static void load_amd_features(struct cpu_raw_data_t* raw, struct cpu_id_t* data)
{ 7, CPU_FEATURE_HWPSTATE },
{ 8, CPU_FEATURE_CONSTANT_TSC },
};
if (raw->ext_cpuid[0][0] >= 1) {
if (raw->ext_cpuid[0][0] >= 0x80000001) {
match_features(matchtable_edx81, COUNT_OF(matchtable_edx81), raw->ext_cpuid[1][3], data);
match_features(matchtable_ecx81, COUNT_OF(matchtable_ecx81), raw->ext_cpuid[1][2], data);
}
if (raw->ext_cpuid[0][0] >= 7)
if (raw->ext_cpuid[0][0] >= 0x80000001)
match_features(matchtable_edx87, COUNT_OF(matchtable_edx87), raw->ext_cpuid[7][3], data);
if (raw->ext_cpuid[0][0] >= 0x1a) {
if (raw->ext_cpuid[0][0] >= 0x8000001a) {
/* We have the extended info about SSE unit size */
data->detection_hints[CPU_HINT_SSE_SIZE_AUTH] = 1;
data->sse_size = (raw->ext_cpuid[0x1a][0] & 1) ? 128 : 64;
@ -409,6 +423,10 @@ static amd_code_t decode_amd_codename_part1(const char *bs)
if (strstr(bs, "Duron")) return DURON;
if (strstr(bs, "Athlon")) return ATHLON;
}
if (match_pattern(bs, "C-##")) return FUSION_C;
if (match_pattern(bs, "E-###")) return FUSION_E;
if (match_pattern(bs, "Z-##")) return FUSION_Z;
if (match_pattern(bs, "E#-####") || match_pattern(bs, "A#-####")) return FUSION_EA;
return NO_CODE;
}