summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2011-02-22 18:45:38 -0500
committerDave Jones <davej@redhat.com>2011-02-22 18:45:38 -0500
commit5d82ff4e572c5b8573f8848668feca5555e0e120 (patch)
tree010de136320611510116dbf5d35f2657b334e4a4
parentbe19cd5f12fcc827c1c2533bc50902dd2111ff64 (diff)
Fix topology parsing
-rw-r--r--Intel/info.c2
-rw-r--r--Intel/topology.c19
-rw-r--r--topology.c7
-rw-r--r--x86info.c4
-rw-r--r--x86info.h1
5 files changed, 21 insertions, 12 deletions
diff --git a/Intel/info.c b/Intel/info.c
index 3a9746f..53f391b 100644
--- a/Intel/info.c
+++ b/Intel/info.c
@@ -139,6 +139,4 @@ void display_Intel_info(struct cpudata *cpu)
if (show_microcode)
decode_microcode(cpu);
-
- show_intel_topology(cpu);
}
diff --git a/Intel/topology.c b/Intel/topology.c
index 8aeb4b2..c6f5eb0 100644
--- a/Intel/topology.c
+++ b/Intel/topology.c
@@ -79,7 +79,7 @@ static int phys_pkg_id(int cpuid_apic, int index_msb)
return cpuid_apic >> index_msb;
}
-void show_intel_topology(struct cpudata *cpu)
+void get_intel_topology(struct cpudata *cpu)
{
unsigned int eax, ebx, ecx, edx;
unsigned int index_msb, core_bits;
@@ -99,7 +99,8 @@ void show_intel_topology(struct cpudata *cpu)
cpu->num_siblings = (ebx & 0xff0000) >> 16;
if (cpu->num_siblings == 1) {
- printf("Hyper-Threading is disabled\n");
+ if (debug)
+ printf("Hyper-Threading is disabled\n");
goto out;
}
@@ -120,10 +121,14 @@ void show_intel_topology(struct cpudata *cpu)
cpu->cpu_core_id = phys_pkg_id(cpu->apicid, index_msb) &
((1 << core_bits) - 1);
-out:
- if ((cpu->x86_max_cores * cpu->num_siblings) > 1) {
- printf("Siblings: %d\n", cpu->num_siblings);
- printf("Physical Processor ID: %d\n", cpu->phys_proc_id);
- printf("Processor Core ID: %d\n", cpu->cpu_core_id);
+ if (debug == 1) {
+ if ((cpu->x86_max_cores * cpu->num_siblings) > 1) {
+ printf("%s:\n", __func__);
+ printf("Siblings: %d\n", cpu->num_siblings);
+ printf("Physical Processor ID: %d\n", cpu->phys_proc_id);
+ printf("Processor Core ID: %d\n", cpu->cpu_core_id);
+ }
}
+out:
+ return;
}
diff --git a/topology.c b/topology.c
index 86ad05d..9382c80 100644
--- a/topology.c
+++ b/topology.c
@@ -32,6 +32,13 @@ void display_topology(struct cpudata *head)
int num_sockets = 0;
+ /* For now, we only support topology parsing on Intel. */
+ if (head->vendor == VENDOR_INTEL)
+ get_intel_topology(head);
+ else
+ return;
+
+
if (debug == 1) {
cpu = head;
printf("cpu->phys_proc_id: ");
diff --git a/x86info.c b/x86info.c
index 1a50579..d8d3f2b 100644
--- a/x86info.c
+++ b/x86info.c
@@ -244,10 +244,8 @@ int main (int argc, char **argv)
}
}
- /* For now, we only support topology parsing on Intel. */
cpu = firstcpu;
- if (cpu->vendor == VENDOR_INTEL)
- display_topology(firstcpu);
+ display_topology(firstcpu);
printf(" running at an estimated ");
display_MHz(cpu);
diff --git a/x86info.h b/x86info.h
index ac09e15..8be80de 100644
--- a/x86info.h
+++ b/x86info.h
@@ -173,6 +173,7 @@ void show_benchmarks(struct cpudata *cpu);
void decode_serial_number(struct cpudata *cpu);
void display_topology(struct cpudata *head);
+void get_intel_topology(struct cpudata *cpu);
void show_intel_topology(struct cpudata *cpu);
void decode_AMD_cacheinfo(struct cpudata *cpu);