[coreboot-gerrit] Patch set updated for coreboot: msrtool: use a bit more clever cpuid vendor match
Lubomir Rintel (lkundrak@v3.sk)
gerrit at coreboot.org
Mon Feb 13 19:55:10 CET 2017
Lubomir Rintel (lkundrak at v3.sk) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18255
-gerrit
commit 0ade8d1b35858f97ae6a183e678f9011476166ad
Author: Lubomir Rintel <lkundrak at v3.sk>
Date: Sun Jan 22 22:19:21 2017 +0100
msrtool: use a bit more clever cpuid vendor match
Not everything non-intel is AMD.
Change-Id: I06d6fbaa0b4f2c9e61d9b3b4aeeb349a91aa090e
Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>
---
util/msrtool/msrtool.h | 4 ++--
util/msrtool/sys.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/util/msrtool/msrtool.h b/util/msrtool/msrtool.h
index fe7f0f0..6565fff 100644
--- a/util/msrtool/msrtool.h
+++ b/util/msrtool/msrtool.h
@@ -94,8 +94,8 @@ struct msrdef {
#define MAX_CORES 8
typedef enum {
- VENDOR_INTEL = 1,
- VENDOR_AMD = 2,
+ VENDOR_INTEL = 0x756e6547,
+ VENDOR_AMD = 0x68747541,
} vendor_t;
struct cpuid_t {
diff --git a/util/msrtool/sys.c b/util/msrtool/sys.c
index cb300d9..0ab880d 100644
--- a/util/msrtool/sys.c
+++ b/util/msrtool/sys.c
@@ -36,7 +36,7 @@ struct cpuid_t *cpuid(void) {
asm ("cpuid" : "=b" (outebx) : "a" (0) : "%ecx", "%edx");
#endif
- id.vendor = (outebx == 0x756e6547) ? VENDOR_INTEL : VENDOR_AMD;
+ id.vendor = outebx;
/* Then, identificate CPU itself */
#if defined(__DARWIN__) && !defined(__LP64__)
@@ -58,9 +58,9 @@ struct cpuid_t *cpuid(void) {
outeax >>= 8;
id.ext_model = outeax & 0xf;
outeax >>= 4;
- id.ext_family = outeax & 0xff;
- if ((0xf == id.family) || ((VENDOR_INTEL == id.vendor)
- && (0x6 == id.family))) {
+ id.ext_family = outeax & 0xfe;
+ if ((VENDOR_AMD == id.vendor && 0xf == id.family) ||
+ (VENDOR_INTEL == id.vendor && 0x6 == id.family)) {
/* Intel says always do this, AMD says only for family f */
id.model |= (id.ext_model << 4);
id.family += id.ext_family;
More information about the coreboot-gerrit
mailing list