diff --git a/libcpuid/cpuid_main.c b/libcpuid/cpuid_main.c index 6f5b7da..b486a3d 100644 --- a/libcpuid/cpuid_main.c +++ b/libcpuid/cpuid_main.c @@ -179,9 +179,6 @@ static void load_features_common(struct cpu_raw_data_t* raw, struct cpu_id_t* da const struct feature_map_t matchtable_ecx81[] = { { 0, CPU_FEATURE_LAHF_LM }, }; - const struct feature_map_t matchtable_edx87[] = { - { 8, CPU_FEATURE_CONSTANT_TSC }, - }; if (raw->basic_cpuid[0][0] >= 1) { match_features(matchtable_edx1, COUNT_OF(matchtable_edx1), raw->basic_cpuid[1][3], data); match_features(matchtable_ecx1, COUNT_OF(matchtable_ecx1), raw->basic_cpuid[1][2], data); @@ -190,8 +187,6 @@ static void load_features_common(struct cpu_raw_data_t* raw, struct cpu_id_t* da 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) - match_features(matchtable_edx87, COUNT_OF(matchtable_edx87), raw->ext_cpuid[7][3], data); } static int cpuid_basic_identify(struct cpu_raw_data_t* raw, struct cpu_id_t* data) @@ -470,6 +465,14 @@ const char* cpu_feature_str(cpu_feature_t feature) { CPU_FEATURE_SSE5, "sse5" }, { CPU_FEATURE_SKINIT, "skinit" }, { CPU_FEATURE_WDT, "wdt" }, + { CPU_FEATURE_TS, "ts" }, + { CPU_FEATURE_FID, "fid" }, + { CPU_FEATURE_VID, "vid" }, + { CPU_FEATURE_TTP, "ttp" }, + { CPU_FEATURE_TM_AMD, "tm_amd" }, + { CPU_FEATURE_STC, "stc" }, + { CPU_FEATURE_100MHZSTEPS, "100mhzsteps" }, + { CPU_FEATURE_HWPSTATE, "hwpstate" }, { CPU_FEATURE_CONSTANT_TSC, "constant_tsc" }, }; unsigned i, n = COUNT_OF(matchtable); diff --git a/libcpuid/libcpuid.h b/libcpuid/libcpuid.h index 2d3c031..ae85606 100644 --- a/libcpuid/libcpuid.h +++ b/libcpuid/libcpuid.h @@ -294,6 +294,14 @@ enum _cpu_feature_t { CPU_FEATURE_SSE5, /*!< SSE 5 instructions supported */ CPU_FEATURE_SKINIT, /*!< SKINIT / STGI supported */ CPU_FEATURE_WDT, /*!< Watchdog timer support */ + CPU_FEATURE_TS, /*!< Temperature sensor */ + CPU_FEATURE_FID, /*!< Frequency ID control */ + CPU_FEATURE_VID, /*!< Voltage ID control */ + CPU_FEATURE_TTP, /*!< THERMTRIP */ + CPU_FEATURE_TM_AMD, /*!< AMD-specified hardware thermal control */ + CPU_FEATURE_STC, /*!< Software thermal control */ + CPU_FEATURE_100MHZSTEPS,/*!< 100 MHz multiplier control */ + CPU_FEATURE_HWPSTATE, /*!< Hardware P-state control */ CPU_FEATURE_CONSTANT_TSC, /*!< TSC ticks at constant rate */ // termination: NUM_CPU_FEATURES, @@ -417,7 +425,7 @@ int cpu_identify(struct cpu_raw_data_t* raw, struct cpu_id_t* data); * @param feature - the feature, whose textual representation is wanted. * @returns a constant string like "fpu", "tsc", "sse2", etc. * @note the names of the returned flags are compatible with those from - * /proc/cpuinfo in Linux. + * /proc/cpuinfo in Linux, with the exception of `tm_amd' */ const char* cpu_feature_str(cpu_feature_t feature); diff --git a/libcpuid/recog_amd.c b/libcpuid/recog_amd.c index 3ada1f9..24cea05 100644 --- a/libcpuid/recog_amd.c +++ b/libcpuid/recog_amd.c @@ -175,10 +175,23 @@ static void load_amd_features(struct cpu_raw_data_t* raw, struct cpu_id_t* data) { 12, CPU_FEATURE_SKINIT }, { 13, CPU_FEATURE_WDT }, }; + const struct feature_map_t matchtable_edx87[] = { + { 0, CPU_FEATURE_TS }, + { 1, CPU_FEATURE_FID }, + { 2, CPU_FEATURE_VID }, + { 3, CPU_FEATURE_TTP }, + { 4, CPU_FEATURE_TM_AMD }, + { 5, CPU_FEATURE_STC }, + { 6, CPU_FEATURE_100MHZSTEPS }, + { 7, CPU_FEATURE_HWPSTATE }, + { 8, CPU_FEATURE_CONSTANT_TSC }, + }; if (raw->ext_cpuid[0][0] >= 1) { 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) + match_features(matchtable_edx87, COUNT_OF(matchtable_edx87), raw->ext_cpuid[7][3], data); } static void decode_amd_cache_info(struct cpu_raw_data_t* raw, struct cpu_id_t* data)