[coreboot] New patch to review for coreboot: c0e1751 Revert "msrtool: Fix Intel CPUs detection"

Peter Stuge (peter@stuge.se) gerrit at coreboot.org
Tue Jul 10 02:46:39 CEST 2012


Peter Stuge (peter at stuge.se) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1197

-gerrit

commit c0e1751323f50d7c81c949504b78f9ca7889e1d2
Author: Peter Stuge <peter at stuge.se>
Date:   Tue Jul 10 02:46:39 2012 +0200

    Revert "msrtool: Fix Intel CPUs detection"
    
    This reverts commit ffbbecc9eed9705d7fdb9f6825ab7ccd9224fb09
    which was discussed out of band and a new patch set was
    forthcoming. The reviewer could have saved this in Gerrit and
    the author could have abandoned the change, to make this
    clear for third parties. Revert in anticipation of the new
    patch set.
---
 util/msrtool/intel_core1.c          |    2 +-
 util/msrtool/intel_core2_early.c    |    2 +-
 util/msrtool/intel_pentium3.c       |    5 +----
 util/msrtool/intel_pentium3_early.c |    5 +----
 util/msrtool/intel_pentium4_early.c |    2 +-
 util/msrtool/intel_pentium4_later.c |    5 +----
 util/msrtool/msrtool.h              |    2 --
 util/msrtool/sys.c                  |   19 +------------------
 8 files changed, 7 insertions(+), 35 deletions(-)

diff --git a/util/msrtool/intel_core1.c b/util/msrtool/intel_core1.c
index 1ebc7df..c7837c6 100644
--- a/util/msrtool/intel_core1.c
+++ b/util/msrtool/intel_core1.c
@@ -21,7 +21,7 @@
 
 int intel_core1_probe(const struct targetdef *target) {
 	struct cpuid_t *id = cpuid();
-	return ((0x6 == id->family) && (0xe == id->model));
+	return ((0x6 == id->family)&(0xe == id->model));
 }
 
 const struct msrdef intel_core1_msrs[] = {
diff --git a/util/msrtool/intel_core2_early.c b/util/msrtool/intel_core2_early.c
index 674d7db..0c6e15f 100644
--- a/util/msrtool/intel_core2_early.c
+++ b/util/msrtool/intel_core2_early.c
@@ -21,7 +21,7 @@
 
 int intel_core2_early_probe(const struct targetdef *target) {
 	struct cpuid_t *id = cpuid();
-	return ((0x6 == id->family) && (0xf == id->model));
+	return ((0x6 == id->family)&(0xf == id->model));
 }
 
 const struct msrdef intel_core2_early_msrs[] = {
diff --git a/util/msrtool/intel_pentium3.c b/util/msrtool/intel_pentium3.c
index 442ae3d..a2b4225 100644
--- a/util/msrtool/intel_pentium3.c
+++ b/util/msrtool/intel_pentium3.c
@@ -21,10 +21,7 @@
 
 int intel_pentium3_probe(const struct targetdef *target) {
 	struct cpuid_t *id = cpuid();
-	return ((0x6 == id->family) && (
-		(0xa == id->model) ||
-		(0xb == id->model)
-		));
+	return ((0x6 == id->family)&((0xa == id->model)|(0xb == id->model)));
 }
 
 const struct msrdef intel_pentium3_msrs[] = {
diff --git a/util/msrtool/intel_pentium3_early.c b/util/msrtool/intel_pentium3_early.c
index ced3037..5de74c1 100644
--- a/util/msrtool/intel_pentium3_early.c
+++ b/util/msrtool/intel_pentium3_early.c
@@ -21,10 +21,7 @@
 
 int intel_pentium3_early_probe(const struct targetdef *target) {
 	struct cpuid_t *id = cpuid();
-	return ((0x6 == id->family) && (
-		(0x7 == id->model) ||
-		(0x8 == id->model)
-		));
+	return ((0x6 == id->family)&((0x7 == id->model)|(0x8 == id->model)));
 }
 
 const struct msrdef intel_pentium3_early_msrs[] = {
diff --git a/util/msrtool/intel_pentium4_early.c b/util/msrtool/intel_pentium4_early.c
index cb6c53e..d6703d2 100644
--- a/util/msrtool/intel_pentium4_early.c
+++ b/util/msrtool/intel_pentium4_early.c
@@ -21,7 +21,7 @@
 
 int intel_pentium4_early_probe(const struct targetdef *target) {
 	struct cpuid_t *id = cpuid();
-	return ((0xf == id->family) && (0x2 == id->model));
+	return ((0xf == id->family)&(0x2 == id->model));
 }
 
 const struct msrdef intel_pentium4_early_msrs[] = {
diff --git a/util/msrtool/intel_pentium4_later.c b/util/msrtool/intel_pentium4_later.c
index 7c077ee..6bb6ebe 100644
--- a/util/msrtool/intel_pentium4_later.c
+++ b/util/msrtool/intel_pentium4_later.c
@@ -21,10 +21,7 @@
 
 int intel_pentium4_later_probe(const struct targetdef *target) {
 	struct cpuid_t *id = cpuid();
-	return ((0xf == id->family) && (
-		(0x3 == id->model) ||
-		(0x4 == id->model)
-		));
+	return ((0xf == id->family)&((0x3 == id->model)|(0x4 == id->model)));
 }
 
 const struct msrdef intel_pentium4_later_msrs[] = {
diff --git a/util/msrtool/msrtool.h b/util/msrtool/msrtool.h
index 162e743..e6cea46 100644
--- a/util/msrtool/msrtool.h
+++ b/util/msrtool/msrtool.h
@@ -126,7 +126,6 @@ struct sysdef {
 #define SYSTEM_EOT .name = NULL
 #define SYSTEM_ISEOT(s) (NULL == (s).name)
 
-typedef enum { VENDOR_INTEL = 1, VENDOR_AMD = 2 } vendor_t;
 
 struct cpuid_t {
 	uint8_t family;
@@ -134,7 +133,6 @@ struct cpuid_t {
 	uint8_t stepping;
 	uint8_t ext_family;
 	uint8_t ext_model;
-	vendor_t vendor;
 };
 
 
diff --git a/util/msrtool/sys.c b/util/msrtool/sys.c
index 7300abf..f6aded5 100644
--- a/util/msrtool/sys.c
+++ b/util/msrtool/sys.c
@@ -26,23 +26,7 @@ static struct cpuid_t id;
 
 struct cpuid_t *cpuid(void) {
 	uint32_t outeax;
-	uint32_t outebx;
 
-/* First, we need determine which vendor we have */
-#if defined(__DARWIN__) && !defined(__LP64__)
-        asm volatile (
-                "pushl %%ebx    \n"
-                "cpuid          \n"
-                "popl %%ebx     \n"
-                : "=b" (outebx) : "a" (0) : "%ecx", "%edx"
-        );
-#else
-	asm ("cpuid" : "=b" (outebx) : "a" (0) : "%ecx", "%edx");
-#endif
-
-	id.vendor = (outebx == 0x756e6547) ? VENDOR_INTEL : VENDOR_AMD;
-
-/* Then, identificate CPU itself */
 #if defined(__DARWIN__) && !defined(__LP64__)
         asm volatile (
                 "pushl %%ebx    \n"
@@ -63,8 +47,7 @@ struct cpuid_t *cpuid(void) {
 	id.ext_model = outeax & 0xf;
 	outeax >>= 4;
 	id.ext_family = outeax & 0xff;
-	if ((0xf == id.family) || ((VENDOR_INTEL == id.vendor)
-			&& (0x6 == id.family))) {
+	if (0xf == 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 mailing list