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

@ -494,7 +494,7 @@ typedef enum cpu_types {
B_CPU_INTEL_PENTIUM_M = 0x1069,
B_CPU_INTEL_PENTIUM_III_XEON = 0x106a,
B_CPU_INTEL_PENTIUM_III_MODEL_11 = 0x106b,
B_CPU_INTEL_ATOM = 0x1106c,
B_CPU_INTEL_ATOM = 0x1106c,
B_CPU_INTEL_PENTIUM_M_MODEL_13 = 0x106d, /* Dothan */
B_CPU_INTEL_PENTIUM_CORE,
B_CPU_INTEL_PENTIUM_CORE_2,
@ -513,15 +513,14 @@ typedef enum cpu_types {
/* AMD */
/* Checked with "AMD Processor Recognition Application Note"
* (Table 3)
* 20734.pdf
*/
// AMD Processor Recognition Application Note
B_CPU_AMD_x86 = 0x1100,
// Family 5h
B_CPU_AMD_K5_MODEL_0 = 0x1150,
B_CPU_AMD_K5_MODEL_1,
B_CPU_AMD_K5_MODEL_2,
B_CPU_AMD_K5_MODEL_3,
B_CPU_AMD_K5_MODEL_1 = 0x1151,
B_CPU_AMD_K5_MODEL_2 = 0x1152,
B_CPU_AMD_K5_MODEL_3 = 0x1153,
B_CPU_AMD_K6_MODEL_6 = 0x1156,
B_CPU_AMD_K6_MODEL_7 = 0x1157,
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_MODEL_13 = 0x115d,
B_CPU_AMD_GEODE_LX = 0x115a,
// Family 6h
B_CPU_AMD_ATHLON_MODEL_1 = 0x1161,
B_CPU_AMD_ATHLON_MODEL_2 = 0x1162,
B_CPU_AMD_DURON = 0x1163,
B_CPU_AMD_ATHLON_THUNDERBIRD = 0x1164,
B_CPU_AMD_ATHLON_XP = 0x1166,
B_CPU_AMD_ATHLON_XP_MODEL_7,
B_CPU_AMD_ATHLON_XP_MODEL_8,
B_CPU_AMD_ATHLON_XP_MODEL_6 = 0x1166,
B_CPU_AMD_ATHLON_XP_MODEL_7 = 0x1167,
B_CPU_AMD_ATHLON_XP_MODEL_8 = 0x1168,
B_CPU_AMD_ATHLON_XP_MODEL_10 = 0x116a, /* Barton */
B_CPU_AMD_SEMPRON_MODEL_8 = B_CPU_AMD_ATHLON_XP_MODEL_8,
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)
*/
// Family fh
B_CPU_AMD_ATHLON_64_MODEL_3 = 0x11f3,
B_CPU_AMD_ATHLON_64_MODEL_4,
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_4 = 0x11f4,
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_12,
B_CPU_AMD_ATHLON_64_MODEL_12 = 0x11fc,
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 */
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_MODEL_13:
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_2:
case B_CPU_AMD_ATHLON_THUNDERBIRD:
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_10:
return "Athlon XP";
case B_CPU_AMD_DURON:
case B_CPU_AMD_ATHLON_XP_MODEL_7:
return "Duron";
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_8:
case B_CPU_AMD_ATHLON_64_MODEL_11:
case B_CPU_AMD_ATHLON_64_MODEL_12:
case B_CPU_AMD_ATHLON_64_MODEL_14:
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";
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";
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";
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";
case B_CPU_AMD_GEODE_LX:
return "Geode LX";
case B_CPU_AMD_A_SERIES:
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 */
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_INTEL_x86) {
if (base == B_CPU_INTEL_x86
|| (base == B_CPU_AMD_x86 && cpu->arch.family == 0xF)) {
model = (cpu->arch.extended_family << 20)
+ (cpu->arch.extended_model << 16)
+ (cpu->arch.family << 4) + cpu->arch.model;
} else {
model = (cpu->arch.family << 4) +
cpu->arch.model;
// There isn't much useful information yet in the extended
// family and extended model fields of AMD processors
// and is probably undefined for others
model = (cpu->arch.family << 4)
+ cpu->arch.model;
// Isn't much useful extended family and model information
// yet on other processors.
}
}