[platform][pc] print some ACPI table information at boot
@@ -227,6 +227,27 @@ void platform_early_init(void) {
#endif
}
+void local_apic_callback(const void *_entry, size_t entry_len) {
+ const struct acpi_madt_local_apic_entry *entry = _entry;
+
+ printf("\tLOCAL APIC id %d, processor id %d, flags %#x\n",
+ entry->apic_id, entry->processor_id, entry->flags);
+}
+
+void io_apic_callback(const void *_entry, size_t entry_len) {
+ const struct acpi_madt_io_apic_entry *entry = _entry;
+
+ printf("\tIO APIC id %d, address %#x gsi base %u\n",
+ entry->io_apic_id, entry->io_apic_address, entry->global_system_interrupt_base);
+}
+
+void int_source_override_callback(const void *_entry, size_t entry_len) {
+ const struct acpi_madt_int_source_override_entry *entry = _entry;
+
+ printf("\tINT OVERRIDE bus %u, source %u, gsi %u, flags %#x\n",
+ entry->bus, entry->source, entry->global_sys_interrupt, entry->flags);
+}
+
void platform_init(void) {
platform_init_debug();
@@ -234,6 +255,16 @@ void platform_init(void) {
bool pci_initted = false;
if (acpi_lite_init(0) == NO_ERROR) {
+ if (LOCAL_TRACE) {
+ acpi_lite_dump_tables();
+ }
+
+ // dump the APIC table
+ printf("MADT/APIC table:\n");
+ acpi_process_madt_entries_etc(ACPI_MADT_TYPE_LOCAL_APIC, &local_apic_callback);
+ acpi_process_madt_entries_etc(ACPI_MADT_TYPE_IO_APIC, &io_apic_callback);
+ acpi_process_madt_entries_etc(ACPI_MADT_TYPE_INT_SOURCE_OVERRIDE, &int_source_override_callback);
+
// try to find the mcfg table
const struct acpi_mcfg_table *table = (const struct acpi_mcfg_table *)acpi_get_table_by_sig(ACPI_MCFG_SIG);
if (table) {
