[syslinux:master] hdt: Improving CPU display

syslinux-bot for Erwan Velu erwanaliasr1 at gmail.com
Sun Feb 6 14:07:45 PST 2011


Commit-ID:  98d58026c4bf38e42adcfbd5f92da29fb582d41a
Gitweb:     http://syslinux.zytor.com/commit/98d58026c4bf38e42adcfbd5f92da29fb582d41a
Author:     Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Sun, 30 Jan 2011 15:06:40 +0100
Committer:  Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Sun, 30 Jan 2011 15:06:40 +0100

hdt: Improving CPU display



---
 com32/hdt/hdt-cli-cpu.c        |    3 +--
 com32/hdt/hdt-common.c         |    5 +++++
 com32/hdt/hdt-common.h         |    1 +
 com32/hdt/hdt-menu-processor.c |    3 +--
 com32/hdt/hdt-menu-summary.c   |    7 ++++---
 5 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/com32/hdt/hdt-cli-cpu.c b/com32/hdt/hdt-cli-cpu.c
index de0c9cd..ca095a6 100644
--- a/com32/hdt/hdt-cli-cpu.c
+++ b/com32/hdt/hdt-cli-cpu.c
@@ -45,8 +45,7 @@ void main_show_cpu(int argc __unused, char **argv __unused,
     if (hardware->acpi.madt.processor_local_apic_count > 0) {
 	more_printf("CPU (%d logical / %d phys)\n",
 		    hardware->acpi.madt.processor_local_apic_count,
-		    hardware->acpi.madt.processor_local_apic_count /
-		    hardware->cpu.num_cores);
+		    hardware->physical_cpu_count);
     } else
 	more_printf("CPU\n");
     more_printf(" Manufacturer : %s \n", hardware->cpu.vendor);
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index ded079e..5953be3 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -184,6 +184,7 @@ void init_hardware(struct s_hardware *hardware)
     hardware->is_acpi_valid = false;
     hardware->pci_domain = NULL;
     hardware->detected_memory_size = 0;
+    hardware->physical_cpu_count =1; /* we have at least one cpu */
 
     /* Cleaning structures */
     memset(hardware->disk_info, 0, sizeof(hardware->disk_info));
@@ -563,6 +564,10 @@ void cpu_detect(struct s_hardware *hardware)
      * That makes some weird display in console/menu
      * Let's remove that mulitple spaces */
     strlcpy(hardware->cpu.model,del_multi_spaces(hardware->cpu.model),sizeof(hardware->cpu.model));
+
+    if ((hardware->is_acpi_valid) && (hardware->acpi.madt.valid)) {
+    	hardware->physical_cpu_count=hardware->acpi.madt.processor_local_apic_count / hardware->cpu.num_cores;
+    }
     hardware->cpu_detection = true;
 }
 
diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h
index 3aa5a50..df7d2c9 100644
--- a/com32/hdt/hdt-common.h
+++ b/com32/hdt/hdt-common.h
@@ -173,6 +173,7 @@ struct s_vesa {
 struct s_hardware {
     s_dmi dmi;			/* DMI table */
     s_cpu cpu;			/* CPU information */
+    uint8_t physical_cpu_count; /* Number of physical cpu */
     s_vpd vpd;			/* VPD information */
     s_acpi acpi;
     struct pci_domain *pci_domain;	/* PCI Devices */
diff --git a/com32/hdt/hdt-menu-processor.c b/com32/hdt/hdt-menu-processor.c
index ca3e154..ad4a8ba 100644
--- a/com32/hdt/hdt-menu-processor.c
+++ b/com32/hdt/hdt-menu-processor.c
@@ -58,8 +58,7 @@ void compute_processor(struct s_my_menu *menu, struct s_hardware *hardware)
 	snprintf(buffer, sizeof buffer,
 		 " Main Processors (%d logical / %d phys. ) ",
 		 hardware->acpi.madt.processor_local_apic_count,
-		 hardware->acpi.madt.processor_local_apic_count /
-		 hardware->cpu.num_cores);
+		 hardware->physical_cpu_count);
 	menu->menu = add_menu(buffer, -1);
 	menu->items_count = 0;
 	set_menu_pos(SUBMENU_Y, SUBMENU_X);
diff --git a/com32/hdt/hdt-menu-summary.c b/com32/hdt/hdt-menu-summary.c
index e9d56ca..d02f3c3 100644
--- a/com32/hdt/hdt-menu-summary.c
+++ b/com32/hdt/hdt-menu-summary.c
@@ -34,7 +34,8 @@ void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware)
     char buffer[SUBMENULEN + 1];
     char statbuffer[STATLEN + 1];
 
-    menu->menu = add_menu(" Summary ", -1);
+    snprintf(buffer, sizeof(buffer), " Summary (%d CPU) ", hardware->physical_cpu_count);
+    menu->menu = add_menu(buffer, -1);
     menu->items_count = 0;
 
     set_menu_pos(SUBMENU_Y, SUBMENU_X);
@@ -60,9 +61,9 @@ void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware)
     else
 	strcat(features, ", 32bit");
     if (hardware->cpu.flags.smp)
-	strcat(features, ", SMP ");
+	strcat(features, ", SMP");
     if (hardware->cpu.flags.vmx || hardware->cpu.flags.svm)
-	strcat(features, ", HwVIRT ");
+	strcat(features, ", HwVIRT");
     snprintf(buffer, sizeof buffer, "%s", features);
     snprintf(statbuffer, sizeof statbuffer, "Features : %s", features);
     add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);



More information about the Syslinux-commits mailing list