[syslinux:master] hdt: Displaying multi processor systems
syslinux-bot for Erwan Velu
erwan.velu at free.fr
Sun Feb 6 14:07:13 PST 2011
Commit-ID: 497faa0100db0c8868baef0154d12f0556e749ee
Gitweb: http://syslinux.zytor.com/commit/497faa0100db0c8868baef0154d12f0556e749ee
Author: Erwan Velu <erwan.velu at free.fr>
AuthorDate: Mon, 7 Dec 2009 15:34:26 +0100
Committer: Erwan Velu <erwan.velu at free.fr>
CommitDate: Mon, 7 Dec 2009 15:34:26 +0100
hdt: Displaying multi processor systems
Impact: Multi cpu systems are now detected
Let's compute the number of physical processor we have
---
com32/hdt/hdt-cli-acpi.c | 52 ++++++++++++++++++++++++++--------------
com32/hdt/hdt-cli-cpu.c | 18 ++++++++++++-
com32/hdt/hdt-menu-processor.c | 17 ++++++++++--
3 files changed, 64 insertions(+), 23 deletions(-)
diff --git a/com32/hdt/hdt-cli-acpi.c b/com32/hdt/hdt-cli-acpi.c
index 1e5b31a..a8a4352 100644
--- a/com32/hdt/hdt-cli-acpi.c
+++ b/com32/hdt/hdt-cli-acpi.c
@@ -129,8 +129,8 @@ static void show_local_apic(s_madt * madt)
if ((sla->flags & PROCESSOR_LOCAL_APIC_ENABLE) ==
PROCESSOR_LOCAL_APIC_ENABLE)
strcpy(buffer, "enable");
- more_printf("CPU #%d, LAPIC (acpi_id[0x%02x]) %s\n", sla->apic_id,
- sla->acpi_id, buffer);
+ more_printf("CPU #%u, LAPIC (acpi_id[0x%02x] apic_id[0x%02x]) %s\n",
+ sla->apic_id, sla->acpi_id, sla->apic_id, buffer);
}
}
@@ -141,12 +141,13 @@ static char *flags_to_string(char *buffer, uint16_t flags)
if ((flags & POLARITY_ACTIVE_HIGH) == POLARITY_ACTIVE_HIGH)
strcpy(buffer, "high");
else if ((flags & POLARITY_ACTIVE_LOW) == POLARITY_ACTIVE_LOW)
- strcpy(buffer, "low");
+ strcpy(buffer, "low");
if ((flags & TRIGGER_EDGE) == TRIGGER_EDGE)
- strncat(buffer, " edge", 5);
+ strncat(buffer, " edge", 5);
else if ((flags & TRIGGER_LEVEL) == TRIGGER_LEVEL)
- strncat(buffer, " level", 6);
- else strncat(buffer, " default", 8);
+ strncat(buffer, " level", 6);
+ else
+ strncat(buffer, " default", 8);
return buffer;
}
@@ -161,7 +162,9 @@ static void show_local_apic_nmi(s_madt * madt)
s_local_apic_nmi *slan = &madt->local_apic_nmi[i];
char buffer[20];
more_printf("LAPIC_NMI (acpi_id[0x%02x] %s lint(0x%02x))\n",
- slan->acpi_processor_id, flags_to_string(buffer,slan->flags), slan->local_apic_lint);
+ slan->acpi_processor_id, flags_to_string(buffer,
+ slan->flags),
+ slan->local_apic_lint);
}
}
@@ -175,15 +178,23 @@ static void show_io_apic(s_madt * madt)
s_io_apic *sio = &madt->io_apic[i];
char buffer[15];
memset(buffer, 0, sizeof(buffer));
- switch(sio->global_system_interrupt_base) {
- case 0: strcpy(buffer, "GSI 0-23"); break;
- case 24: strcpy(buffer, "GSI 24-39"); break;
- case 40: strcpy(buffer, "GSI 40-55"); break;
- default: strcpy(buffer, "GSI Unknown"); break;
+ switch (sio->global_system_interrupt_base) {
+ case 0:
+ strcpy(buffer, "GSI 0-23");
+ break;
+ case 24:
+ strcpy(buffer, "GSI 24-39");
+ break;
+ case 40:
+ strcpy(buffer, "GSI 40-55");
+ break;
+ default:
+ strcpy(buffer, "GSI Unknown");
+ break;
}
more_printf("IO_APIC[%d] : apic_id[0x%02x] adress[0x%08x] %s\n",
- i,sio->io_apic_id, sio->io_apic_address,buffer);
+ i, sio->io_apic_id, sio->io_apic_address, buffer);
}
}
@@ -197,15 +208,20 @@ static void show_interrupt_source_override(s_madt * madt)
s_interrupt_source_override *siso = &madt->interrupt_source_override[i];
char buffer[20];
char bus_type[10];
- memset(bus_type,0,sizeof(bus_type));
- if (siso->bus==0) strcpy(bus_type,"ISA");
- else strcpy(bus_type,"unknown");
+ memset(bus_type, 0, sizeof(bus_type));
+ if (siso->bus == 0)
+ strcpy(bus_type, "ISA");
+ else
+ strcpy(bus_type, "unknown");
more_printf("INT_SRC_OVR (bus %s (%d) bus_irq %d global_irq %d %s)\n",
- bus_type,siso->bus, siso->source, siso->global_system_interrupt ,
- flags_to_string(buffer,siso->flags));
+ bus_type, siso->bus, siso->source,
+ siso->global_system_interrupt, flags_to_string(buffer,
+ siso->
+ flags));
}
}
+
static void show_acpi_madt(int argc __unused, char **argv __unused,
struct s_hardware *hardware)
{
diff --git a/com32/hdt/hdt-cli-cpu.c b/com32/hdt/hdt-cli-cpu.c
index 359669e..b7949f3 100644
--- a/com32/hdt/hdt-cli-cpu.c
+++ b/com32/hdt/hdt-cli-cpu.c
@@ -38,7 +38,13 @@ void main_show_cpu(int argc __unused, char **argv __unused,
struct s_hardware *hardware)
{
char features[81];
- more_printf("CPU\n");
+ 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);
+ } else
+ more_printf("CPU\n");
more_printf(" Manufacturer : %s \n", hardware->cpu.vendor);
more_printf(" Product : %s \n", hardware->cpu.model);
more_printf(" CPU Cores : %d \n", hardware->cpu.num_cores);
@@ -79,7 +85,13 @@ static void show_cpu(int argc __unused, char **argv __unused,
{
char buffer[81];
reset_more_printf();
- more_printf("CPU\n");
+ 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);
+ } else
+ more_printf("CPU\n");
more_printf("Vendor : %s\n", hardware->cpu.vendor);
more_printf("Model : %s\n", hardware->cpu.model);
more_printf("CPU Cores : %d\n", hardware->cpu.num_cores);
@@ -102,11 +114,13 @@ static void show_cpu(int argc __unused, char **argv __unused,
hardware->dmi.processor.voltage_mv -
((hardware->dmi.processor.voltage_mv / 1000) * 1000));
}
+
if (hardware->cpu.flags.smp) {
more_printf("SMP : yes\n");
} else {
more_printf("SMP : no\n");
}
+
if (hardware->cpu.flags.lm) {
more_printf("x86_64 : yes\n");
} else {
diff --git a/com32/hdt/hdt-menu-processor.c b/com32/hdt/hdt-menu-processor.c
index f303eb6..ca3e154 100644
--- a/com32/hdt/hdt-menu-processor.c
+++ b/com32/hdt/hdt-menu-processor.c
@@ -54,9 +54,20 @@ void compute_processor(struct s_my_menu *menu, struct s_hardware *hardware)
char buffer1[SUBMENULEN + 1];
char statbuffer[STATLEN + 1];
- menu->menu = add_menu(" Main Processor ", -1);
- menu->items_count = 0;
- set_menu_pos(SUBMENU_Y, SUBMENU_X);
+ if (hardware->acpi.madt.processor_local_apic_count > 0) {
+ 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);
+ menu->menu = add_menu(buffer, -1);
+ menu->items_count = 0;
+ set_menu_pos(SUBMENU_Y, SUBMENU_X);
+ } else {
+ menu->menu = add_menu(" Main Processor ", -1);
+ menu->items_count = 0;
+ set_menu_pos(SUBMENU_Y, SUBMENU_X);
+ }
snprintf(buffer, sizeof buffer, "Vendor : %s", hardware->cpu.vendor);
snprintf(statbuffer, sizeof statbuffer, "Vendor: %s", hardware->cpu.vendor);
More information about the Syslinux-commits
mailing list