Skip to content

Commit

Permalink
fix and improve
Browse files Browse the repository at this point in the history
- bugfix 5122 logic
- add support for 0000 parts (pre-production)
- add note on 0x55=85
- remove unnecessary characters
  • Loading branch information
Jeff Hammond committed Apr 16, 2019
1 parent 0c2e7ea commit 2dba574
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions vpu-count.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
#endif

#ifdef DEBUG
#define PDEBUG(fmt, ...) do { printf(fmt, __VA_ARGS__); } while (0)
#define PDEBUG(...) printf(__VA_ARGS__)
#else
#define PDEBUG(fmt, ...)
#define PDEBUG(...)
#endif

void get_cpu_name32(char cpu_name[32])
Expand Down Expand Up @@ -122,7 +122,7 @@ void get_leaf1(uint32_t leaf1[4], bool * skylake_avx512)
model += (xmodel << 4);
//family += xfamily;
}
*skylake_avx512 = (model == 0x55);
*skylake_avx512 = (model == 0x55); /* 85 in binary */

PDEBUG("signature: %#08x\n", (leaf1[0]) );
//PDEBUG("stepping: %#04x=%d\n", stepping, stepping);
Expand Down Expand Up @@ -194,7 +194,7 @@ int vpu_count(void)
PDEBUG("cpu_name[9] = %c\n", cpu_name[9]);
PDEBUG("cpu_name[17] = %c\n", cpu_name[17]);

/* Skylake-X series: * "Intel(R) Core (TM)..." */
/* Skylake-X series: "Intel(R) Core (TM)..." */
if (cpu_name[9] == 'C') {
return 2;
}
Expand All @@ -217,7 +217,7 @@ int vpu_count(void)
if (cpu_name[22] == '6') {
return 2;
/* 5122 */
} else if (cpu_name[22] == 5 && cpu_name[24] == 2 && cpu_name[25] == 2) {
} else if (cpu_name[22] == '5' && cpu_name[24] == '2' && cpu_name[25] == '2') {
return 2;
/* 51xx */
} else {
Expand All @@ -235,6 +235,10 @@ int vpu_count(void)
}
}
}
/* Pre-production parts: Genuine Intel(R) CPU 0000 */
else if (cpu_name[0] == 'G' && cpu_name[21] == '0' && cpu_name[22] == '0' && cpu_name[23] == '0' && cpu_name[24] == '0') {
return 2;
}
/* If we get here, the part is not supported by the SKX logic */
return -1;
}
Expand Down

0 comments on commit 2dba574

Please sign in to comment.