mirror of
https://github.com/anrieff/libcpuid
synced 2024-12-16 16:35:45 +00:00
Support for Nehalem Xeons added
git-svn-id: https://svn.code.sf.net/p/libcpuid/code/HEAD/libcpuid@60 3b4be424-7ac5-41d7-8526-f4ddcb85d872
This commit is contained in:
parent
8f1f12828d
commit
103bb027c6
5 changed files with 159 additions and 11 deletions
|
@ -0,0 +1,4 @@
|
|||
Version 0.1.0:
|
||||
* Initial public release
|
||||
Version 0.1.1:
|
||||
* Support for Intel Nehalem architecture CPUs (Core i7, Xeon i7)
|
|
@ -131,3 +131,39 @@ void generic_get_cpu_list(const struct match_entry_t* matchtable, int count,
|
|||
}
|
||||
list->num_entries = n;
|
||||
}
|
||||
|
||||
static int xmatch_entry(char c, const char* p)
|
||||
{
|
||||
int i, j;
|
||||
if (c == 0) return -1;
|
||||
if (c == p[0]) return 1;
|
||||
if (p[0] == '.') return 1;
|
||||
if (p[0] == '#' && isdigit(c)) return 1;
|
||||
if (p[0] == '[') {
|
||||
j = 1;
|
||||
while (p[j] && p[j] != ']') j++;
|
||||
if (!p[j]) return -1;
|
||||
for (i = 1; i < j; i++)
|
||||
if (p[i] == c) return j + 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int match_pattern(const char* s, const char* p)
|
||||
{
|
||||
int i, j, dj, k, n, m;
|
||||
n = (int) strlen(s);
|
||||
m = (int) strlen(p);
|
||||
for (i = 0; i < n; i++) {
|
||||
if (xmatch_entry(s[i], p)) {
|
||||
j = 0;
|
||||
k = 0;
|
||||
while (j < m && ((dj = xmatch_entry(s[i + k], p + j)) != -1)) {
|
||||
k++;
|
||||
j += dj;
|
||||
}
|
||||
if (j == m) return i + 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,18 @@ __attribute__((format(printf, 2, 3)))
|
|||
void generic_get_cpu_list(const struct match_entry_t* matchtable, int count,
|
||||
struct cpu_list_t* list);
|
||||
|
||||
/*
|
||||
* Seek for a pattern in `haystack'.
|
||||
* Pattern may be an fixed string, or contain the special metacharacters
|
||||
* '.' - match any single character
|
||||
* '#' - match any digit
|
||||
* '[<chars>] - match any of the given chars (regex-like ranges are not
|
||||
* supported)
|
||||
* Return val: 0 if the pattern is not found. Nonzero if it is found (actually,
|
||||
* x + 1 where x is the index where the match is found).
|
||||
*/
|
||||
int match_pattern(const char* haystack, const char* pattern);
|
||||
|
||||
extern libcpuid_warn_fn_t _warn_fun;
|
||||
extern int _current_verboselevel;
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ enum _intel_code_t {
|
|||
XEON_IRWIN,
|
||||
XEONMP,
|
||||
XEON_POTOMAC,
|
||||
XEON_I7,
|
||||
MOBILE_PENTIUM_M,
|
||||
CELERON,
|
||||
MOBILE_CELERON,
|
||||
|
@ -239,6 +240,8 @@ const struct match_entry_t cpudb_intel[] = {
|
|||
|
||||
{ 6, 10, -1, -1, 26, 1, -1, CORE_Ix , 0, "Intel Core i7" },
|
||||
{ 6, 10, -1, -1, 26, 4, -1, CORE_Ix , 0, "Bloomfield (Core i7)" },
|
||||
{ 6, 10, -1, -1, 26, 4, -1, XEON_I7 , 0, "Xeon (Bloomfield)" },
|
||||
|
||||
|
||||
/* Core microarchitecture-based Xeons: */
|
||||
{ 6, 14, -1, -1, 14, 1, -1, XEON , 0, "Xeon LV" },
|
||||
|
@ -521,7 +524,7 @@ static intel_code_t get_brand_code(struct cpu_id_t* data)
|
|||
intel_code_t code = NO_CODE;
|
||||
int i, need_matchtable = 1;
|
||||
const char* bs = data->brand_str;
|
||||
const char* s, *ixs;
|
||||
const char* s;
|
||||
const struct { intel_code_t c; const char *search; } matchtable[] = {
|
||||
{ XEONMP, "Xeon MP" },
|
||||
{ XEONMP, "Xeon(TM) MP" },
|
||||
|
@ -546,13 +549,10 @@ static intel_code_t get_brand_code(struct cpu_id_t* data)
|
|||
else if (strstr(bs, "Pentium"))
|
||||
code = MOBILE_PENTIUM;
|
||||
}
|
||||
ixs = strstr(bs, "Core(TM) i");
|
||||
if (ixs) {
|
||||
if (ixs[10] == '3' || ixs[10] == '5' || ixs[10] == '7') {
|
||||
/* Core i3, Core i5 or Core i7 */
|
||||
need_matchtable = 0;
|
||||
code = CORE_Ix;
|
||||
}
|
||||
if (match_pattern(bs, "Core(TM) i[357]")) {
|
||||
/* Core i3, Core i5 or Core i7 */
|
||||
need_matchtable = 0;
|
||||
code = CORE_Ix;
|
||||
}
|
||||
if (need_matchtable) {
|
||||
for (i = 0; i < COUNT_OF(matchtable); i++)
|
||||
|
@ -561,9 +561,12 @@ static intel_code_t get_brand_code(struct cpu_id_t* data)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (code == XEON && data->l3_cache > 0)
|
||||
code = XEON_IRWIN;
|
||||
if (code == XEON) {
|
||||
if (match_pattern(bs, "W####"))
|
||||
code = XEON_I7;
|
||||
else if (data->l3_cache > 0)
|
||||
code = XEON_IRWIN;
|
||||
}
|
||||
if (code == XEONMP && data->l3_cache > 0)
|
||||
code = XEON_POTOMAC;
|
||||
if (code == CORE_SOLO) {
|
||||
|
|
|
@ -3028,3 +3028,96 @@ intel_fn11[3]=00000000 00000000 00000003 00000003
|
|||
Bloomfield (Core i7)
|
||||
fpu vme de pse tsc msr pae mce cx8 apic mtrr sep pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni dts64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 xd popcnt lm lahf_lm
|
||||
--------------------------------------------------------------------------------
|
||||
basic_cpuid[0]=0000000b 756e6547 6c65746e 49656e69
|
||||
basic_cpuid[1]=000106a5 00100800 009ce3bd bfebfbff
|
||||
basic_cpuid[2]=55035a01 00f0b2e4 00000000 09ca212c
|
||||
basic_cpuid[3]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[4]=1c004121 01c0003f 0000003f 00000000
|
||||
basic_cpuid[5]=00000040 00000040 00000003 00001120
|
||||
basic_cpuid[6]=00000001 00000002 00000001 00000000
|
||||
basic_cpuid[7]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[8]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[9]=00000000 00000000 00000000 00000000
|
||||
basic_cpuid[10]=07300403 00000044 00000000 00000603
|
||||
basic_cpuid[11]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[12]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[13]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[14]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[15]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[16]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[17]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[18]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[19]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[20]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[21]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[22]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[23]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[24]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[25]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[26]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[27]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[28]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[29]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[30]=00000001 00000002 00000100 00000000
|
||||
basic_cpuid[31]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[0]=80000008 00000000 00000000 00000000
|
||||
ext_cpuid[1]=00000000 00000000 00000001 28100000
|
||||
ext_cpuid[2]=65746e49 2952286c 6f655820 2952286e
|
||||
ext_cpuid[3]=55504320 20202020 20202020 57202020
|
||||
ext_cpuid[4]=30323533 20402020 37362e32 007a4847
|
||||
ext_cpuid[5]=00000000 00000000 00000000 00000000
|
||||
ext_cpuid[6]=00000000 00000000 01006040 00000000
|
||||
ext_cpuid[7]=00000000 00000000 00000000 00000100
|
||||
ext_cpuid[8]=00003024 00000000 00000000 00000000
|
||||
ext_cpuid[9]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[10]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[11]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[12]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[13]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[14]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[15]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[16]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[17]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[18]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[19]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[20]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[21]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[22]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[23]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[24]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[25]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[26]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[27]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[28]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[29]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[30]=00000001 00000002 00000100 00000000
|
||||
ext_cpuid[31]=00000001 00000002 00000100 00000000
|
||||
intel_fn4[0]=1c004121 01c0003f 0000003f 00000000
|
||||
intel_fn4[1]=1c004122 00c0003f 0000007f 00000000
|
||||
intel_fn4[2]=1c004143 01c0003f 000001ff 00000000
|
||||
intel_fn4[3]=1c03c163 03c0003f 00001fff 00000002
|
||||
intel_fn11[0]=00000001 00000002 00000100 00000000
|
||||
intel_fn11[1]=00000004 00000008 00000201 00000000
|
||||
intel_fn11[2]=00000000 00000000 00000002 00000000
|
||||
intel_fn11[3]=00000000 00000000 00000003 00000000
|
||||
--------------------------------------------------------------------------------
|
||||
6
|
||||
10
|
||||
5
|
||||
6
|
||||
26
|
||||
4
|
||||
8
|
||||
32
|
||||
32
|
||||
256
|
||||
8192
|
||||
8
|
||||
8
|
||||
16
|
||||
64
|
||||
64
|
||||
64
|
||||
Xeon (Bloomfield)
|
||||
fpu vme de pse tsc msr pae mce cx8 apic mtrr sep pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni dts64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 xd popcnt lm lahf_lm
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue