We have to decouple the enumeration and marking of the NMIs from the actual NMI

pin configuration as the configuration only happens after preparing the
configuration where we already need the NMI mask.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41536 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2011-05-16 14:59:25 +00:00
parent 0f6581066d
commit aa373c439f

View File

@ -335,6 +335,8 @@ ioapic_map_ioapic(struct ioapic& ioapic, phys_addr_t physicalAddress)
ioapic.global_interrupt_last
= ioapic.global_interrupt_base + ioapic.max_redirection_entry;
ioapic.nmi_mask = 0;
return B_OK;
}
@ -345,10 +347,8 @@ ioapic_initialize_ioapic(struct ioapic& ioapic, uint8 targetAPIC)
// program the APIC ID
ioapic_write_32(ioapic, IO_APIC_ID, ioapic.apic_id << IO_APIC_ID_SHIFT);
ioapic.level_triggered_mask = 0;
ioapic.nmi_mask = 0;
// program the interrupt vectors of the io-apic
ioapic.level_triggered_mask = 0;
uint8 gsi = ioapic.global_interrupt_base;
for (uint8 i = 0; i <= ioapic.max_redirection_entry; i++, gsi++) {
// initialize everything to deliver to the boot CPU in physical mode
@ -441,6 +441,25 @@ acpi_enumerate_ioapics(acpi_table_madt* madt)
lastIOAPIC = ioapic;
break;
}
case ACPI_MADT_TYPE_NMI_SOURCE:
{
acpi_madt_nmi_source* info
= (acpi_madt_nmi_source*)apicEntry;
dprintf("found nmi source global irq %lu, flags 0x%04x\n",
(uint32)info->GlobalIrq, (uint16)info->IntiFlags);
struct ioapic* ioapic = find_ioapic(info->GlobalIrq);
if (ioapic == NULL) {
dprintf("nmi source for gsi that is not mapped to any "
" io-apic\n");
break;
}
uint8 pin = info->GlobalIrq - ioapic->global_interrupt_base;
ioapic->nmi_mask |= (uint64)1 << pin;
break;
}
}
apicEntry
@ -530,15 +549,10 @@ acpi_configure_source_overrides(acpi_table_madt* madt)
(uint32)info->GlobalIrq, (uint16)info->IntiFlags);
struct ioapic* ioapic = find_ioapic(info->GlobalIrq);
if (ioapic == NULL) {
dprintf("nmi source for gsi that is not mapped to any "
" io-apic\n");
if (ioapic == NULL)
break;
}
uint8 pin = info->GlobalIrq - ioapic->global_interrupt_base;
ioapic->nmi_mask |= (uint64)1 << pin;
uint32 config = acpi_madt_convert_inti_flags(info->IntiFlags);
ioapic_configure_pin(*ioapic, pin, info->GlobalIrq, config,
IO_APIC_DELIVERY_MODE_NMI);