cpuid: Rework AMD CPUID numbers

* If family is 0xF, we grab extended family and model
  like Intel does
* Idenfify AMD cpu's more correctly
This commit is contained in:
Alexander von Gluck IV 2012-06-04 14:11:43 -05:00
parent bd12d75f96
commit 548b1a4988
3 changed files with 108 additions and 44 deletions

View File

@ -513,15 +513,14 @@ typedef enum cpu_types {
/* AMD */ /* AMD */
/* Checked with "AMD Processor Recognition Application Note" // AMD Processor Recognition Application Note
* (Table 3)
* 20734.pdf
*/
B_CPU_AMD_x86 = 0x1100, B_CPU_AMD_x86 = 0x1100,
// Family 5h
B_CPU_AMD_K5_MODEL_0 = 0x1150, B_CPU_AMD_K5_MODEL_0 = 0x1150,
B_CPU_AMD_K5_MODEL_1, B_CPU_AMD_K5_MODEL_1 = 0x1151,
B_CPU_AMD_K5_MODEL_2, B_CPU_AMD_K5_MODEL_2 = 0x1152,
B_CPU_AMD_K5_MODEL_3, B_CPU_AMD_K5_MODEL_3 = 0x1153,
B_CPU_AMD_K6_MODEL_6 = 0x1156, B_CPU_AMD_K6_MODEL_6 = 0x1156,
B_CPU_AMD_K6_MODEL_7 = 0x1157, B_CPU_AMD_K6_MODEL_7 = 0x1157,
B_CPU_AMD_K6_MODEL_8 = 0x1158, B_CPU_AMD_K6_MODEL_8 = 0x1158,
@ -530,42 +529,70 @@ typedef enum cpu_types {
B_CPU_AMD_K6_III = 0x1159, B_CPU_AMD_K6_III = 0x1159,
B_CPU_AMD_K6_III_MODEL_13 = 0x115d, B_CPU_AMD_K6_III_MODEL_13 = 0x115d,
B_CPU_AMD_GEODE_LX = 0x115a,
// Family 6h
B_CPU_AMD_ATHLON_MODEL_1 = 0x1161, B_CPU_AMD_ATHLON_MODEL_1 = 0x1161,
B_CPU_AMD_ATHLON_MODEL_2 = 0x1162, B_CPU_AMD_ATHLON_MODEL_2 = 0x1162,
B_CPU_AMD_DURON = 0x1163, B_CPU_AMD_DURON = 0x1163,
B_CPU_AMD_ATHLON_THUNDERBIRD = 0x1164, B_CPU_AMD_ATHLON_THUNDERBIRD = 0x1164,
B_CPU_AMD_ATHLON_XP = 0x1166, B_CPU_AMD_ATHLON_XP_MODEL_6 = 0x1166,
B_CPU_AMD_ATHLON_XP_MODEL_7, B_CPU_AMD_ATHLON_XP_MODEL_7 = 0x1167,
B_CPU_AMD_ATHLON_XP_MODEL_8, B_CPU_AMD_ATHLON_XP_MODEL_8 = 0x1168,
B_CPU_AMD_ATHLON_XP_MODEL_10 = 0x116a, /* Barton */ B_CPU_AMD_ATHLON_XP_MODEL_10 = 0x116a, /* Barton */
B_CPU_AMD_SEMPRON_MODEL_8 = B_CPU_AMD_ATHLON_XP_MODEL_8, // Family fh
B_CPU_AMD_SEMPRON_MODEL_10 = B_CPU_AMD_ATHLON_XP_MODEL_10,
/* According to "Revision Guide for AMD Family 10h
* Processors" (41322.pdf)
*/
B_CPU_AMD_PHENOM = 0x11f2,
/* According to "Revision guide for AMD Athlon 64
* and AMD Opteron Processors" (25759.pdf)
*/
B_CPU_AMD_ATHLON_64_MODEL_3 = 0x11f3, B_CPU_AMD_ATHLON_64_MODEL_3 = 0x11f3,
B_CPU_AMD_ATHLON_64_MODEL_4, B_CPU_AMD_ATHLON_64_MODEL_4 = 0x11f4,
B_CPU_AMD_ATHLON_64_MODEL_5,
B_CPU_AMD_PHENOM_II = B_CPU_AMD_ATHLON_64_MODEL_4,
B_CPU_AMD_OPTERON = B_CPU_AMD_ATHLON_64_MODEL_5,
B_CPU_AMD_ATHLON_64_FX = B_CPU_AMD_ATHLON_64_MODEL_5,
B_CPU_AMD_ATHLON_64_MODEL_7 = 0x11f7, B_CPU_AMD_ATHLON_64_MODEL_7 = 0x11f7,
B_CPU_AMD_ATHLON_64_MODEL_8, B_CPU_AMD_ATHLON_64_MODEL_8 = 0x11f8,
B_CPU_AMD_ATHLON_64_MODEL_11 = 0x11fb, B_CPU_AMD_ATHLON_64_MODEL_11 = 0x11fb,
B_CPU_AMD_ATHLON_64_MODEL_12, B_CPU_AMD_ATHLON_64_MODEL_12 = 0x11fc,
B_CPU_AMD_ATHLON_64_MODEL_14 = 0x11fe, B_CPU_AMD_ATHLON_64_MODEL_14 = 0x11fe,
B_CPU_AMD_ATHLON_64_MODEL_15, B_CPU_AMD_ATHLON_64_MODEL_15 = 0x11ff,
B_CPU_AMD_ATHLON_64_MODEL_20 = 0x111f4,
B_CPU_AMD_ATHLON_64_MODEL_23 = 0x111f7,
B_CPU_AMD_ATHLON_64_MODEL_24 = 0x111f8,
B_CPU_AMD_ATHLON_64_MODEL_27 = 0x111fb,
B_CPU_AMD_ATHLON_64_MODEL_28 = 0x111fc,
B_CPU_AMD_ATHLON_64_MODEL_31 = 0x111ff,
B_CPU_AMD_ATHLON_64_MODEL_35 = 0x211f3,
B_CPU_AMD_ATHLON_64_MODEL_43 = 0x211fb,
B_CPU_AMD_ATHLON_64_MODEL_44 = 0x211fc,
B_CPU_AMD_ATHLON_64_MODEL_47 = 0x211ff,
B_CPU_AMD_ATHLON_64_MODEL_63 = 0x311ff,
B_CPU_AMD_ATHLON_64_MODEL_79 = 0x411ff,
B_CPU_AMD_ATHLON_64_MODEL_95 = 0x511ff,
B_CPU_AMD_ATHLON_64_MODEL_127 = 0x711ff,
B_CPU_AMD_GEODE_LX = 0x115a, B_CPU_AMD_OPTERON_MODEL_5 = 0x11f5,
B_CPU_AMD_OPTERON_MODEL_21 = 0x111f5,
B_CPU_AMD_OPTERON_MODEL_33 = 0x211f1,
B_CPU_AMD_OPTERON_MODEL_37 = 0x211f5,
B_CPU_AMD_OPTERON_MODEL_39 = 0x211f7,
B_CPU_AMD_TURION_64_MODEL_36 = 0x211f4,
B_CPU_AMD_TURION_64_MODEL_76 = 0x411fc,
B_CPU_AMD_TURION_64_MODEL_104 = 0x611f8,
// Family 10h
B_CPU_AMD_PHENOM_MODEL_2 = 0x1011f2,
B_CPU_AMD_PHENOM_II_MODEL_4 = 0x1011f4,
B_CPU_AMD_PHENOM_II_MODEL_5 = 0x1011f5,
B_CPU_AMD_PHENOM_II_MODEL_6 = 0x1011f6,
B_CPU_AMD_PHENOM_II_MODEL_10 = 0x1011fa,
// Family 12h
B_CPU_AMD_A_SERIES = 0x3011f1,
// Family 14h
B_CPU_AMD_C_SERIES = 0x5011f1,
B_CPU_AMD_E_SERIES = 0x5011f2,
// Family 15h
B_CPU_AMD_FX_SERIES = 0x6011f1, /* Bulldozer */
/* VIA/Cyrix */ /* VIA/Cyrix */
B_CPU_CYRIX_x86 = 0x1200, B_CPU_CYRIX_x86 = 0x1200,

View File

@ -232,33 +232,70 @@ get_cpu_model_string(system_info *info)
case B_CPU_AMD_K6_III: case B_CPU_AMD_K6_III:
case B_CPU_AMD_K6_III_MODEL_13: case B_CPU_AMD_K6_III_MODEL_13:
return "K6-III"; return "K6-III";
case B_CPU_AMD_GEODE_LX:
return "Geode LX";
case B_CPU_AMD_ATHLON_MODEL_1: case B_CPU_AMD_ATHLON_MODEL_1:
case B_CPU_AMD_ATHLON_MODEL_2: case B_CPU_AMD_ATHLON_MODEL_2:
case B_CPU_AMD_ATHLON_THUNDERBIRD: case B_CPU_AMD_ATHLON_THUNDERBIRD:
return "Athlon"; return "Athlon";
case B_CPU_AMD_ATHLON_XP: case B_CPU_AMD_ATHLON_XP_MODEL_6:
case B_CPU_AMD_ATHLON_XP_MODEL_7:
case B_CPU_AMD_ATHLON_XP_MODEL_8: case B_CPU_AMD_ATHLON_XP_MODEL_8:
case B_CPU_AMD_ATHLON_XP_MODEL_10: case B_CPU_AMD_ATHLON_XP_MODEL_10:
return "Athlon XP"; return "Athlon XP";
case B_CPU_AMD_DURON: case B_CPU_AMD_DURON:
case B_CPU_AMD_ATHLON_XP_MODEL_7:
return "Duron"; return "Duron";
case B_CPU_AMD_ATHLON_64_MODEL_3: case B_CPU_AMD_ATHLON_64_MODEL_3:
case B_CPU_AMD_ATHLON_64_MODEL_4:
case B_CPU_AMD_ATHLON_64_MODEL_7: case B_CPU_AMD_ATHLON_64_MODEL_7:
case B_CPU_AMD_ATHLON_64_MODEL_8: case B_CPU_AMD_ATHLON_64_MODEL_8:
case B_CPU_AMD_ATHLON_64_MODEL_11: case B_CPU_AMD_ATHLON_64_MODEL_11:
case B_CPU_AMD_ATHLON_64_MODEL_12: case B_CPU_AMD_ATHLON_64_MODEL_12:
case B_CPU_AMD_ATHLON_64_MODEL_14: case B_CPU_AMD_ATHLON_64_MODEL_14:
case B_CPU_AMD_ATHLON_64_MODEL_15: case B_CPU_AMD_ATHLON_64_MODEL_15:
case B_CPU_AMD_ATHLON_64_MODEL_20:
case B_CPU_AMD_ATHLON_64_MODEL_23:
case B_CPU_AMD_ATHLON_64_MODEL_24:
case B_CPU_AMD_ATHLON_64_MODEL_27:
case B_CPU_AMD_ATHLON_64_MODEL_28:
case B_CPU_AMD_ATHLON_64_MODEL_31:
case B_CPU_AMD_ATHLON_64_MODEL_35:
case B_CPU_AMD_ATHLON_64_MODEL_43:
case B_CPU_AMD_ATHLON_64_MODEL_44:
case B_CPU_AMD_ATHLON_64_MODEL_47:
case B_CPU_AMD_ATHLON_64_MODEL_63:
case B_CPU_AMD_ATHLON_64_MODEL_79:
case B_CPU_AMD_ATHLON_64_MODEL_95:
case B_CPU_AMD_ATHLON_64_MODEL_127:
return "Athlon 64"; return "Athlon 64";
case B_CPU_AMD_OPTERON: case B_CPU_AMD_OPTERON_MODEL_5:
case B_CPU_AMD_OPTERON_MODEL_21:
case B_CPU_AMD_OPTERON_MODEL_33:
case B_CPU_AMD_OPTERON_MODEL_37:
case B_CPU_AMD_OPTERON_MODEL_39:
return "Opteron"; return "Opteron";
case B_CPU_AMD_PHENOM: case B_CPU_AMD_TURION_64_MODEL_36:
case B_CPU_AMD_TURION_64_MODEL_76:
case B_CPU_AMD_TURION_64_MODEL_104:
return "Turion 64";
case B_CPU_AMD_PHENOM_MODEL_2:
return "Phenom"; return "Phenom";
case B_CPU_AMD_PHENOM_II: case B_CPU_AMD_PHENOM_II_MODEL_4:
case B_CPU_AMD_PHENOM_II_MODEL_5:
case B_CPU_AMD_PHENOM_II_MODEL_6:
case B_CPU_AMD_PHENOM_II_MODEL_10:
get_cpuid_model_string(cpuidName);
if (strcasestr(cpuidName, "Athlon") != NULL)
return "Athlon II";
return "Phenom II"; return "Phenom II";
case B_CPU_AMD_GEODE_LX: case B_CPU_AMD_A_SERIES:
return "Geode LX"; return "A-Series";
case B_CPU_AMD_C_SERIES:
return "C-Series";
case B_CPU_AMD_E_SERIES:
return "E-Series";
case B_CPU_AMD_FX_SERIES:
return "FX-Series";
/* Transmeta */ /* Transmeta */
case B_CPU_TRANSMETA_CRUSOE: case B_CPU_TRANSMETA_CRUSOE:

View File

@ -117,16 +117,16 @@ arch_system_info_init(struct kernel_args *args)
} }
if (base != B_CPU_x86) { if (base != B_CPU_x86) {
if (base == B_CPU_INTEL_x86) { if (base == B_CPU_INTEL_x86
|| (base == B_CPU_AMD_x86 && cpu->arch.family == 0xF)) {
model = (cpu->arch.extended_family << 20) model = (cpu->arch.extended_family << 20)
+ (cpu->arch.extended_model << 16) + (cpu->arch.extended_model << 16)
+ (cpu->arch.family << 4) + cpu->arch.model; + (cpu->arch.family << 4) + cpu->arch.model;
} else { } else {
model = (cpu->arch.family << 4) + model = (cpu->arch.family << 4)
cpu->arch.model; + cpu->arch.model;
// There isn't much useful information yet in the extended // Isn't much useful extended family and model information
// family and extended model fields of AMD processors // yet on other processors.
// and is probably undefined for others
} }
} }