summaryrefslogtreecommitdiff
path: root/util/inteltool/cpu.c
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2008-12-04 15:18:20 +0000
committerStefan Reinauer <stepan@openbios.org>2008-12-04 15:18:20 +0000
commit1162f25a49e8f39822123d664cda10fef466b351 (patch)
tree22afd92c49e7b79fdea37c3e3aef6b34cb70af2f /util/inteltool/cpu.c
parentfcf9be3b9305cfddaf74594fcaec4d6f23541154 (diff)
downloadcoreboot-1162f25a49e8f39822123d664cda10fef466b351.tar.xz
Patch to util/inteltool:
* PMBASE dumping now knows the registers. * Add support for i965, i975, ICH8M * Add support for Darwin OS using DirectIO Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3794 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/inteltool/cpu.c')
-rw-r--r--util/inteltool/cpu.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/util/inteltool/cpu.c b/util/inteltool/cpu.c
index 4f3e716037..bde93dee9d 100644
--- a/util/inteltool/cpu.c
+++ b/util/inteltool/cpu.c
@@ -33,13 +33,18 @@ unsigned int cpuid(unsigned int op)
unsigned int ret;
unsigned int dummy2, dummy3, dummy4;
asm volatile (
- "cpuid"
- : "=a" (ret), "=b" (dummy2), "=c" (dummy3), "=d" (dummy4)
+ "pushl %%ebx \n"
+ "cpuid \n"
+ "movl %%ebx, %1 \n"
+ "popl %%ebx \n"
+ : "=a" (ret), "=r" (dummy2), "=c" (dummy3), "=d" (dummy4)
: "a" (op)
+ : "cc"
);
return ret;
}
+#ifndef DARWIN
int msr_readerror = 0;
msr_t rdmsr(int addr)
@@ -72,6 +77,7 @@ msr_t rdmsr(int addr)
return msr;
}
+#endif
int print_intel_core_msrs(void)
{
@@ -273,12 +279,14 @@ int print_intel_core_msrs(void)
return -1;
}
+#ifndef DARWIN
fd_msr = open("/dev/cpu/0/msr", O_RDWR);
if (fd_msr < 0) {
perror("Error while opening /dev/cpu/0/msr");
printf("Did you run 'modprobe msr'?\n");
return -1;
}
+#endif
printf("\n===================== SHARED MSRs (All Cores) =====================\n");
@@ -292,6 +300,7 @@ int print_intel_core_msrs(void)
close(fd_msr);
for (core = 0; core < 8; core++) {
+#ifndef DARWIN
char msrfilename[64];
memset(msrfilename, 0, 64);
sprintf(msrfilename, "/dev/cpu/%d/msr", core);
@@ -303,7 +312,7 @@ int print_intel_core_msrs(void)
*/
if (fd_msr < 0)
break;
-
+#endif
printf("\n====================== UNIQUE MSRs (core %d) ======================\n", core);
for (i = 0; i < cpu->num_per_core_msrs; i++) {
@@ -312,13 +321,15 @@ int print_intel_core_msrs(void)
cpu->per_core_msrs[i].number, msr.hi, msr.lo,
cpu->per_core_msrs[i].name);
}
-
+#ifndef DARWIN
close(fd_msr);
+#endif
}
+#ifndef DARWIN
if (msr_readerror)
printf("\n(*) Some MSRs could not be read. The marked values are unreliable.\n");
-
+#endif
return 0;
}