[syslinux:master] hdt: More info in show madt
syslinux-bot for Erwan Velu
erwan.velu at free.fr
Sun Feb 6 14:07:07 PST 2011
Commit-ID: e15607438e4647d85e4c8e94790641635f192406
Gitweb: http://syslinux.zytor.com/commit/e15607438e4647d85e4c8e94790641635f192406
Author: Erwan Velu <erwan.velu at free.fr>
AuthorDate: Mon, 7 Dec 2009 10:25:51 +0100
Committer: Erwan Velu <erwan.velu at free.fr>
CommitDate: Mon, 7 Dec 2009 10:25:51 +0100
hdt: More info in show madt
Impact: hdt display more info about madt
Madt is now more describes during the boot
---
com32/hdt/hdt-cli-acpi.c | 165 ++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 154 insertions(+), 11 deletions(-)
diff --git a/com32/hdt/hdt-cli-acpi.c b/com32/hdt/hdt-cli-acpi.c
index 5f94495..1241927 100644
--- a/com32/hdt/hdt-cli-acpi.c
+++ b/com32/hdt/hdt-cli-acpi.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <stdlib.h>
#include <errno.h>
+#include <acpi/acpi.h>
static void show_header_32(uint32_t address, s_acpi_description_header * h)
{
@@ -46,6 +47,20 @@ static void show_header(uint64_t address, s_acpi_description_header * h)
h->signature, h->revision, h->oem_id, h->oem_table_id,
h->oem_revision, h->creator_id, h->creator_revision, address)
}
+
+void show_table_separator()
+{
+ more_printf
+ ("----|----|------|--------|----------|-------|-----------|--------------------\n");
+}
+
+void show_table_name()
+{
+ more_printf
+ ("ACPI rev oem table_id oem_rev creator creat_rev @ address \n");
+ show_table_separator();
+}
+
void main_show_acpi(int argc __unused, char **argv __unused,
struct s_hardware *hardware)
{
@@ -55,10 +70,7 @@ void main_show_acpi(int argc __unused, char **argv __unused,
more_printf("No ACPI Tables detected\n");
return;
}
- more_printf
- ("ACPI rev oem table_id oem_rev creator creat_rev @ address \n");
- more_printf
- ("----|----|------|--------|----------|-------|-----------|--------------------\n");
+ show_table_name();
if (hardware->acpi.rsdp.valid) {
s_rsdp *r = &hardware->acpi.rsdp;
more_printf
@@ -66,11 +78,13 @@ void main_show_acpi(int argc __unused, char **argv __unused,
r->revision, r->oem_id, r->address);
}
if (hardware->acpi.rsdt.valid)
- show_header_32(hardware->acpi.rsdt.address, &hardware->acpi.rsdt.header);
+ show_header_32(hardware->acpi.rsdt.address,
+ &hardware->acpi.rsdt.header);
if (hardware->acpi.xsdt.valid)
- show_header_32(hardware->acpi.xsdt.address, &hardware->acpi.xsdt.header);
-
+ show_header_32(hardware->acpi.xsdt.address,
+ &hardware->acpi.xsdt.header);
+
if (hardware->acpi.fadt.valid)
show_header(hardware->acpi.fadt.address, &hardware->acpi.fadt.header);
@@ -80,9 +94,10 @@ void main_show_acpi(int argc __unused, char **argv __unused,
if (hardware->acpi.dsdt.valid)
show_header(hardware->acpi.dsdt.address, &hardware->acpi.dsdt.header);
- for (int i=0;i<hardware->acpi.ssdt_count;i++) {
- if ((hardware->acpi.ssdt[i] != NULL) && (hardware->acpi.ssdt[i]->valid))
- show_header(hardware->acpi.ssdt[i]->address, &hardware->acpi.ssdt[i]->header);
+ for (int i = 0; i < hardware->acpi.ssdt_count; i++) {
+ if ((hardware->acpi.ssdt[i] != NULL) && (hardware->acpi.ssdt[i]->valid))
+ show_header(hardware->acpi.ssdt[i]->address,
+ &hardware->acpi.ssdt[i]->header);
}
if (hardware->acpi.sbst.valid)
@@ -99,8 +114,136 @@ void main_show_acpi(int argc __unused, char **argv __unused,
}
}
+static void show_local_apic(s_madt * madt)
+{
+ printf("Local APIC at 0x%08x\n", madt->local_apic_address);
+ if (madt->processor_local_apic_count == 0) {
+ more_printf("No Processor Local APIC found\n");
+ return;
+ }
+ for (int i = 0; i < madt->processor_local_apic_count; i++) {
+ s_processor_local_apic *sla = &madt->processor_local_apic[i];
+ char buffer[8];
+ memset(buffer, 0, sizeof(buffer));
+ strcpy(buffer, "disable");
+ 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);
+ }
+}
+
+static char *flags_to_string(char *buffer, uint16_t flags)
+{
+ memset(buffer, 0, sizeof(buffer));
+ strcpy(buffer, "default");
+ if ((flags & POLARITY_ACTIVE_HIGH) == POLARITY_ACTIVE_HIGH)
+ strcpy(buffer, "high");
+ else if ((flags & POLARITY_ACTIVE_LOW) == POLARITY_ACTIVE_LOW)
+ strcpy(buffer, "low");
+ if ((flags & TRIGGER_EDGE) == TRIGGER_EDGE)
+ strncat(buffer, " edge", 5);
+ else if ((flags & TRIGGER_LEVEL) == TRIGGER_LEVEL)
+ strncat(buffer, " level", 6);
+ else strncat(buffer, " default", 8);
+
+ return buffer;
+}
+
+static void show_local_apic_nmi(s_madt * madt)
+{
+ if (madt->local_apic_nmi_count == 0) {
+ more_printf("No Local APIC NMI found\n");
+ return;
+ }
+ for (int i = 0; i < madt->local_apic_nmi_count; i++) {
+ 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);
+ }
+}
+
+static void show_io_apic(s_madt * madt)
+{
+ if (madt->io_apic_count == 0) {
+ more_printf("No IO APIC found\n");
+ return;
+ }
+ for (int i = 0; i < madt->io_apic_count; i++) {
+ 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;
+ }
+
+ more_printf("IO_APIC[%d] : apic_id[0x%02x] adress[0x%08x] %s\n",
+ i,sio->io_apic_id, sio->io_apic_address,buffer);
+ }
+}
+
+static void show_interrupt_source_override(s_madt * madt)
+{
+ if (madt->interrupt_source_override_count == 0) {
+ more_printf("No interrupt source override found\n");
+ return;
+ }
+ for (int i = 0; i < madt->interrupt_source_override_count; i++) {
+ 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");
+
+ 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));
+ }
+}
+static void show_acpi_madt(int argc __unused, char **argv __unused,
+ struct s_hardware *hardware)
+{
+ detect_acpi(hardware);
+
+ if (hardware->is_acpi_valid == false) {
+ more_printf("No ACPI Tables detected\n");
+ return;
+ }
+
+ s_madt *madt = &hardware->acpi.madt;
+
+ if (madt->valid == false) {
+ more_printf("No MADT table found\n");
+ return;
+ }
+ show_table_name();
+ show_header(madt->address, &madt->header);
+ show_table_separator();
+ show_local_apic(madt);
+ show_local_apic_nmi(madt);
+ show_io_apic(madt);
+ show_interrupt_source_override(madt);
+}
+
+struct cli_callback_descr list_acpi_show_modules[] = {
+ {
+ .name = "madt",
+ .exec = show_acpi_madt,
+ },
+ {
+ .name = NULL,
+ .exec = NULL,
+ },
+};
+
struct cli_module_descr acpi_show_modules = {
- .modules = NULL,
+ .modules = list_acpi_show_modules,
.default_callback = main_show_acpi,
};
More information about the Syslinux-commits
mailing list