diff options
author | jkim <jkim@FreeBSD.org> | 2007-03-22 18:16:43 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2007-03-22 18:16:43 +0000 |
commit | c06098a4065d7be63bd57c45889a91da9bc0f5e4 (patch) | |
tree | cdaa579af45ece33bafe9e4fe4c9aef8bd85ed29 /sys/i386 | |
parent | 07ec417491720a77d28b1083886826f0141b171c (diff) | |
download | FreeBSD-src-c06098a4065d7be63bd57c45889a91da9bc0f5e4.zip FreeBSD-src-c06098a4065d7be63bd57c45889a91da9bc0f5e4.tar.gz |
Catch up with ACPI-CA 20070320 import.
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/acpica/OsdEnvironment.c | 29 | ||||
-rw-r--r-- | sys/i386/acpica/acpi_machdep.c | 4 | ||||
-rw-r--r-- | sys/i386/acpica/madt.c | 250 | ||||
-rw-r--r-- | sys/i386/conf/NOTES | 5 | ||||
-rw-r--r-- | sys/i386/include/acpica_machdep.h | 44 |
5 files changed, 162 insertions, 170 deletions
diff --git a/sys/i386/acpica/OsdEnvironment.c b/sys/i386/acpica/OsdEnvironment.c index 628bd83..61f5532 100644 --- a/sys/i386/acpica/OsdEnvironment.c +++ b/sys/i386/acpica/OsdEnvironment.c @@ -32,10 +32,12 @@ __FBSDID("$FreeBSD$"); * 6.1 : Environmental support */ #include <sys/types.h> +#include <sys/bus.h> #include <sys/linker_set.h> #include <sys/sysctl.h> #include <contrib/dev/acpica/acpi.h> +#include <contrib/dev/acpica/actables.h> static u_long i386_acpi_root; @@ -54,25 +56,16 @@ AcpiOsTerminate(void) return(0); } -ACPI_STATUS -AcpiOsGetRootPointer(UINT32 Flags, ACPI_POINTER *RsdpPhysicalAddress) +ACPI_PHYSICAL_ADDRESS +AcpiOsGetRootPointer(void) { - ACPI_POINTER ptr; - ACPI_STATUS status; + u_long ptr; - if (i386_acpi_root == 0) { - /* - * The loader passes the physical address at which it found the - * RSDP in a hint. We could recover this rather than searching - * manually here. - */ - status = AcpiFindRootPointer(Flags, &ptr); - if (status == AE_OK) - i386_acpi_root = ptr.Pointer.Physical; - } else - status = AE_OK; + if (i386_acpi_root == 0 && + (resource_long_value("acpi", 0, "rsdp", (long *)&ptr) == 0 || + AcpiFindRootPointer((ACPI_NATIVE_UINT *)&ptr) == AE_OK) && + ptr != 0) + i386_acpi_root = ptr; - RsdpPhysicalAddress->PointerType = ACPI_PHYSICAL_POINTER; - RsdpPhysicalAddress->Pointer.Physical = i386_acpi_root; - return (status); + return (i386_acpi_root); } diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c index 151439c..415ba25 100644 --- a/sys/i386/acpica/acpi_machdep.c +++ b/sys/i386/acpica/acpi_machdep.c @@ -319,8 +319,8 @@ acpi_machdep_init(device_t dev) acpi_install_wakeup_handler(sc); if (intr_model == ACPI_INTR_PIC) - BUS_CONFIG_INTR(dev, AcpiGbl_FADT->SciInt, INTR_TRIGGER_LEVEL, - INTR_POLARITY_LOW); + BUS_CONFIG_INTR(dev, AcpiGbl_FADT.SciInterrupt, + INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW); else acpi_SetIntrModel(intr_model); diff --git a/sys/i386/acpica/madt.c b/sys/i386/acpica/madt.c index 64be224..f6ebd3c 100644 --- a/sys/i386/acpica/madt.c +++ b/sys/i386/acpica/madt.c @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #define NIOAPICS 32 /* Max number of I/O APICs */ #define NLAPICS 32 /* Max number of local APICs */ -typedef void madt_entry_handler(APIC_HEADER *entry, void *arg); +typedef void madt_entry_handler(ACPI_SUBTABLE_HEADER *entry, void *arg); /* These two arrays are indexed by APIC IDs. */ struct ioapic_info { @@ -70,26 +70,29 @@ struct lapic_info { } lapics[NLAPICS]; static int madt_found_sci_override; -static MULTIPLE_APIC_TABLE *madt; +static ACPI_TABLE_MADT *madt; static vm_paddr_t madt_physaddr; static vm_offset_t madt_length; MALLOC_DEFINE(M_MADT, "madt_table", "ACPI MADT Table Items"); -static enum intr_polarity interrupt_polarity(UINT16 Polarity, UINT8 Source); -static enum intr_trigger interrupt_trigger(UINT16 TriggerMode, UINT8 Source); +static enum intr_polarity interrupt_polarity(UINT16 IntiFlags, UINT8 Source); +static enum intr_trigger interrupt_trigger(UINT16 IntiFlags, UINT8 Source); static int madt_find_cpu(u_int acpi_id, u_int *apic_id); static int madt_find_interrupt(int intr, void **apic, u_int *pin); static void *madt_map(vm_paddr_t pa, int offset, vm_offset_t length); static void *madt_map_table(vm_paddr_t pa, int offset, const char *sig); -static void madt_parse_apics(APIC_HEADER *entry, void *arg); -static void madt_parse_interrupt_override(MADT_INTERRUPT_OVERRIDE *intr); -static void madt_parse_ints(APIC_HEADER *entry, void *arg __unused); -static void madt_parse_local_nmi(MADT_LOCAL_APIC_NMI *nmi); -static void madt_parse_nmi(MADT_NMI_SOURCE *nmi); +static void madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *arg); +static void madt_parse_interrupt_override( + ACPI_MADT_INTERRUPT_OVERRIDE *intr); +static void madt_parse_ints(ACPI_SUBTABLE_HEADER *entry, + void *arg __unused); +static void madt_parse_local_nmi(ACPI_MADT_LOCAL_APIC_NMI *nmi); +static void madt_parse_nmi(ACPI_MADT_NMI_SOURCE *nmi); static int madt_probe(void); static int madt_probe_cpus(void); -static void madt_probe_cpus_handler(APIC_HEADER *entry, void *arg __unused); +static void madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry, + void *arg __unused); static int madt_probe_table(vm_paddr_t address); static void madt_register(void *dummy); static int madt_setup_local(void); @@ -161,14 +164,14 @@ madt_map_table(vm_paddr_t pa, int offset, const char *sig) void *table; header = madt_map(pa, offset, sizeof(ACPI_TABLE_HEADER)); - if (strncmp(header->Signature, sig, 4) != 0) { + if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) { madt_unmap(header, sizeof(ACPI_TABLE_HEADER)); return (NULL); } length = header->Length; madt_unmap(header, sizeof(ACPI_TABLE_HEADER)); table = madt_map(pa, offset, length); - if (ACPI_FAILURE(AcpiTbVerifyTableChecksum(table))) { + if (ACPI_FAILURE(AcpiTbChecksum(table, length))) { if (bootverbose) printf("MADT: Failed checksum for table %s\n", sig); madt_unmap(table, length); @@ -192,10 +195,10 @@ madt_unmap_table(void *table) static int madt_probe(void) { - ACPI_POINTER rsdp_ptr; - RSDP_DESCRIPTOR *rsdp; - RSDT_DESCRIPTOR *rsdt; - XSDT_DESCRIPTOR *xsdt; + ACPI_PHYSICAL_ADDRESS rsdp_ptr; + ACPI_TABLE_RSDP *rsdp; + ACPI_TABLE_RSDT *rsdt; + ACPI_TABLE_XSDT *xsdt; int i, count; if (resource_disabled("acpi", 0)) @@ -206,12 +209,9 @@ madt_probe(void) * calls pmap_mapbios() to find the RSDP, we assume that we can use * pmap_mapbios() to map the RSDP. */ - if (AcpiOsGetRootPointer(ACPI_LOGICAL_ADDRESSING, &rsdp_ptr) != AE_OK) + if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0) return (ENXIO); -#ifdef __i386__ - KASSERT(rsdp_ptr.Pointer.Physical < KERNLOAD, ("RSDP too high")); -#endif - rsdp = pmap_mapbios(rsdp_ptr.Pointer.Physical, sizeof(RSDP_DESCRIPTOR)); + rsdp = pmap_mapbios(rsdp_ptr, sizeof(ACPI_TABLE_RSDP)); if (rsdp == NULL) { if (bootverbose) printf("MADT: Failed to map RSDP\n"); @@ -230,38 +230,40 @@ madt_probe(void) * the version 1.0 portion of the RSDP. Version 2.0 has * an additional checksum that we verify first. */ - if (AcpiTbGenerateChecksum(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) { + if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) { if (bootverbose) printf("MADT: RSDP failed extended checksum\n"); return (ENXIO); } - xsdt = madt_map_table(rsdp->XsdtPhysicalAddress, 1, XSDT_SIG); + xsdt = madt_map_table(rsdp->XsdtPhysicalAddress, 1, + ACPI_SIG_XSDT); if (xsdt == NULL) { if (bootverbose) printf("MADT: Failed to map XSDT\n"); return (ENXIO); } - count = (xsdt->Length - sizeof(ACPI_TABLE_HEADER)) / + count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) / sizeof(UINT64); for (i = 0; i < count; i++) if (madt_probe_table(xsdt->TableOffsetEntry[i])) break; madt_unmap_table(xsdt); } else { - rsdt = madt_map_table(rsdp->RsdtPhysicalAddress, 1, RSDT_SIG); + rsdt = madt_map_table(rsdp->RsdtPhysicalAddress, 1, + ACPI_SIG_RSDT); if (rsdt == NULL) { if (bootverbose) printf("MADT: Failed to map RSDT\n"); return (ENXIO); } - count = (rsdt->Length - sizeof(ACPI_TABLE_HEADER)) / + count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) / sizeof(UINT32); for (i = 0; i < count; i++) if (madt_probe_table(rsdt->TableOffsetEntry[i])) break; madt_unmap_table(rsdt); } - pmap_unmapbios((vm_offset_t)rsdp, sizeof(RSDP_DESCRIPTOR)); + pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP)); if (madt_physaddr == 0) { if (bootverbose) printf("MADT: No MADT table found\n"); @@ -275,7 +277,7 @@ madt_probe(void) * Verify that we can map the full table and that its checksum is * correct, etc. */ - madt = madt_map_table(madt_physaddr, 0, APIC_SIG); + madt = madt_map_table(madt_physaddr, 0, ACPI_SIG_MADT); if (madt == NULL) return (ENXIO); madt_unmap_table(madt); @@ -303,7 +305,7 @@ madt_probe_table(vm_paddr_t address) printf("Table '%.4s' at 0x%jx\n", table->Signature, (uintmax_t)address); - if (strncmp(table->Signature, APIC_SIG, 4) != 0) { + if (strncmp(table->Signature, ACPI_SIG_MADT, ACPI_NAME_SIZE) != 0) { madt_unmap(table, sizeof(ACPI_TABLE_HEADER)); return (0); } @@ -320,7 +322,7 @@ static int madt_probe_cpus(void) { - madt = madt_map_table(madt_physaddr, 0, APIC_SIG); + madt = madt_map_table(madt_physaddr, 0, ACPI_SIG_MADT); KASSERT(madt != NULL, ("Unable to re-map MADT")); madt_walk_table(madt_probe_cpus_handler, NULL); madt_unmap_table(madt); @@ -336,10 +338,10 @@ madt_setup_local(void) { madt = pmap_mapbios(madt_physaddr, madt_length); - lapic_init(madt->LocalApicAddress); + lapic_init(madt->Address); printf("ACPI APIC Table: <%.*s %.*s>\n", - (int)sizeof(madt->OemId), madt->OemId, - (int)sizeof(madt->OemTableId), madt->OemTableId); + (int)sizeof(madt->Header.OemId), madt->Header.OemId, + (int)sizeof(madt->Header.OemTableId), madt->Header.OemTableId); /* * We ignore 64-bit local APIC override entries. Should we @@ -378,10 +380,10 @@ madt_setup_io(void) * force it to use level trigger and active-low polarity. */ if (!madt_found_sci_override) { - if (madt_find_interrupt(AcpiGbl_FADT->SciInt, &ioapic, &pin) - != 0) - printf("MADT: Could not find APIC for SCI IRQ %d\n", - AcpiGbl_FADT->SciInt); + if (madt_find_interrupt(AcpiGbl_FADT.SciInterrupt, &ioapic, + &pin) != 0) + printf("MADT: Could not find APIC for SCI IRQ %u\n", + AcpiGbl_FADT.SciInterrupt); else { printf( "MADT: Forcing active-low polarity and level trigger for SCI\n"); @@ -415,46 +417,46 @@ SYSINIT(madt_register, SI_SUB_CPU - 1, SI_ORDER_FIRST, madt_register, NULL) static void madt_walk_table(madt_entry_handler *handler, void *arg) { - APIC_HEADER *entry; + ACPI_SUBTABLE_HEADER *entry; u_char *p, *end; - end = (u_char *)(madt) + madt->Length; + end = (u_char *)(madt) + madt->Header.Length; for (p = (u_char *)(madt + 1); p < end; ) { - entry = (APIC_HEADER *)p; + entry = (ACPI_SUBTABLE_HEADER *)p; handler(entry, arg); p += entry->Length; } } static void -madt_probe_cpus_handler(APIC_HEADER *entry, void *arg) +madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) { - MADT_PROCESSOR_APIC *proc; + ACPI_MADT_LOCAL_APIC *proc; struct lapic_info *la; switch (entry->Type) { - case APIC_PROCESSOR: + case ACPI_MADT_TYPE_LOCAL_APIC: /* * The MADT does not include a BSP flag, so we have to * let the MP code figure out which CPU is the BSP on * its own. */ - proc = (MADT_PROCESSOR_APIC *)entry; + proc = (ACPI_MADT_LOCAL_APIC *)entry; if (bootverbose) - printf("MADT: Found CPU APIC ID %d ACPI ID %d: %s\n", - proc->LocalApicId, proc->ProcessorId, - proc->ProcessorEnabled ? "enabled" : "disabled"); - if (!proc->ProcessorEnabled) + printf("MADT: Found CPU APIC ID %u ACPI ID %u: %s\n", + proc->Id, proc->ProcessorId, + (proc->LapicFlags & ACPI_MADT_ENABLED) ? + "enabled" : "disabled"); + if (!(proc->LapicFlags & ACPI_MADT_ENABLED)) break; - if (proc->LocalApicId >= NLAPICS) - panic("%s: CPU ID %d too high", __func__, - proc->LocalApicId); - la = &lapics[proc->LocalApicId]; + if (proc->Id >= NLAPICS) + panic("%s: CPU ID %u too high", __func__, proc->Id); + la = &lapics[proc->Id]; KASSERT(la->la_enabled == 0, - ("Duplicate local APIC ID %d", proc->LocalApicId)); + ("Duplicate local APIC ID %u", proc->Id)); la->la_enabled = 1; la->la_acpi_id = proc->ProcessorId; - lapic_create(proc->LocalApicId, 0); + lapic_create(proc->Id, 0); break; } } @@ -464,26 +466,26 @@ madt_probe_cpus_handler(APIC_HEADER *entry, void *arg) * Add an I/O APIC from an entry in the table. */ static void -madt_parse_apics(APIC_HEADER *entry, void *arg __unused) +madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *arg __unused) { - MADT_IO_APIC *apic; + ACPI_MADT_IO_APIC *apic; switch (entry->Type) { - case APIC_IO: - apic = (MADT_IO_APIC *)entry; + case ACPI_MADT_TYPE_IO_APIC: + apic = (ACPI_MADT_IO_APIC *)entry; if (bootverbose) - printf("MADT: Found IO APIC ID %d, Interrupt %d at %p\n", - apic->IoApicId, apic->Interrupt, + printf( + "MADT: Found IO APIC ID %u, Interrupt %u at %p\n", + apic->Id, apic->GlobalIrqBase, (void *)(uintptr_t)apic->Address); - if (apic->IoApicId >= NIOAPICS) - panic("%s: I/O APIC ID %d too high", __func__, - apic->IoApicId); - if (ioapics[apic->IoApicId].io_apic != NULL) - panic("%s: Double APIC ID %d", __func__, - apic->IoApicId); - ioapics[apic->IoApicId].io_apic = ioapic_create(apic->Address, - apic->IoApicId, apic->Interrupt); - ioapics[apic->IoApicId].io_vector = apic->Interrupt; + if (apic->Id >= NIOAPICS) + panic("%s: I/O APIC ID %u too high", __func__, + apic->Id); + if (ioapics[apic->Id].io_apic != NULL) + panic("%s: Double APIC ID %u", __func__, apic->Id); + ioapics[apic->Id].io_apic = ioapic_create(apic->Address, + apic->Id, apic->GlobalIrqBase); + ioapics[apic->Id].io_vector = apic->GlobalIrqBase; break; default: break; @@ -497,18 +499,18 @@ madt_parse_apics(APIC_HEADER *entry, void *arg __unused) * SCI for which we use Active Lo, Level Triggered. */ static enum intr_polarity -interrupt_polarity(UINT16 Polarity, UINT8 Source) +interrupt_polarity(UINT16 IntiFlags, UINT8 Source) { - switch (Polarity) { - case POLARITY_CONFORMS: - if (Source == AcpiGbl_FADT->SciInt) + switch (IntiFlags & ACPI_MADT_POLARITY_MASK) { + case ACPI_MADT_POLARITY_CONFORMS: + if (Source == AcpiGbl_FADT.SciInterrupt) return (INTR_POLARITY_LOW); else return (INTR_POLARITY_HIGH); - case POLARITY_ACTIVE_HIGH: + case ACPI_MADT_POLARITY_ACTIVE_HIGH: return (INTR_POLARITY_HIGH); - case POLARITY_ACTIVE_LOW: + case ACPI_MADT_POLARITY_ACTIVE_LOW: return (INTR_POLARITY_LOW); default: panic("Bogus Interrupt Polarity"); @@ -516,18 +518,18 @@ interrupt_polarity(UINT16 Polarity, UINT8 Source) } static enum intr_trigger -interrupt_trigger(UINT16 TriggerMode, UINT8 Source) +interrupt_trigger(UINT16 IntiFlags, UINT8 Source) { - switch (TriggerMode) { - case TRIGGER_CONFORMS: - if (Source == AcpiGbl_FADT->SciInt) + switch (IntiFlags & ACPI_MADT_TRIGGER_MASK) { + case ACPI_MADT_TRIGGER_CONFORMS: + if (Source == AcpiGbl_FADT.SciInterrupt) return (INTR_TRIGGER_LEVEL); else return (INTR_TRIGGER_EDGE); - case TRIGGER_EDGE: + case ACPI_MADT_TRIGGER_EDGE: return (INTR_TRIGGER_EDGE); - case TRIGGER_LEVEL: + case ACPI_MADT_TRIGGER_LEVEL: return (INTR_TRIGGER_LEVEL); default: panic("Bogus Interrupt Trigger Mode"); @@ -585,7 +587,7 @@ madt_find_interrupt(int intr, void **apic, u_int *pin) * Parse an interrupt source override for an ISA interrupt. */ static void -madt_parse_interrupt_override(MADT_INTERRUPT_OVERRIDE *intr) +madt_parse_interrupt_override(ACPI_MADT_INTERRUPT_OVERRIDE *intr) { void *new_ioapic, *old_ioapic; u_int new_pin, old_pin; @@ -593,20 +595,19 @@ madt_parse_interrupt_override(MADT_INTERRUPT_OVERRIDE *intr) enum intr_polarity pol; char buf[64]; - if (acpi_quirks & ACPI_Q_MADT_IRQ0 && intr->Source == 0 && - intr->Interrupt == 2) { + if (acpi_quirks & ACPI_Q_MADT_IRQ0 && intr->SourceIrq == 0 && + intr->GlobalIrq == 2) { if (bootverbose) printf("MADT: Skipping timer override\n"); return; } if (bootverbose) printf("MADT: Interrupt override: source %u, irq %u\n", - intr->Source, intr->Interrupt); + intr->SourceIrq, intr->GlobalIrq); KASSERT(intr->Bus == 0, ("bus for interrupt overrides must be zero")); - if (madt_find_interrupt(intr->Interrupt, &new_ioapic, - &new_pin) != 0) { - printf("MADT: Could not find APIC for vector %d (IRQ %d)\n", - intr->Interrupt, intr->Source); + if (madt_find_interrupt(intr->GlobalIrq, &new_ioapic, &new_pin) != 0) { + printf("MADT: Could not find APIC for vector %u (IRQ %u)\n", + intr->GlobalIrq, intr->SourceIrq); return; } @@ -614,15 +615,15 @@ madt_parse_interrupt_override(MADT_INTERRUPT_OVERRIDE *intr) * Lookup the appropriate trigger and polarity modes for this * entry. */ - trig = interrupt_trigger(intr->TriggerMode, intr->Source); - pol = interrupt_polarity(intr->Polarity, intr->Source); + trig = interrupt_trigger(intr->IntiFlags, intr->SourceIrq); + pol = interrupt_polarity(intr->IntiFlags, intr->SourceIrq); /* * If the SCI is identity mapped but has edge trigger and * active-hi polarity or the force_sci_lo tunable is set, * force it to use level/lo. */ - if (intr->Source == AcpiGbl_FADT->SciInt) { + if (intr->SourceIrq == AcpiGbl_FADT.SciInterrupt) { madt_found_sci_override = 1; if (getenv_string("hw.acpi.sci.trigger", buf, sizeof(buf))) { if (tolower(buf[0]) == 'e') @@ -651,23 +652,24 @@ madt_parse_interrupt_override(MADT_INTERRUPT_OVERRIDE *intr) } /* Remap the IRQ if it is mapped to a different interrupt vector. */ - if (intr->Source != intr->Interrupt) { + if (intr->SourceIrq != intr->GlobalIrq) { /* * If the SCI is remapped to a non-ISA global interrupt, * then override the vector we use to setup and allocate * the interrupt. */ - if (intr->Interrupt > 15 && - intr->Source == AcpiGbl_FADT->SciInt) - acpi_OverrideInterruptLevel(intr->Interrupt); + if (intr->GlobalIrq > 15 && + intr->SourceIrq == AcpiGbl_FADT.SciInterrupt) + acpi_OverrideInterruptLevel(intr->GlobalIrq); else - ioapic_remap_vector(new_ioapic, new_pin, intr->Source); - if (madt_find_interrupt(intr->Source, &old_ioapic, + ioapic_remap_vector(new_ioapic, new_pin, + intr->SourceIrq); + if (madt_find_interrupt(intr->SourceIrq, &old_ioapic, &old_pin) != 0) - printf("MADT: Could not find APIC for source IRQ %d\n", - intr->Source); + printf("MADT: Could not find APIC for source IRQ %u\n", + intr->SourceIrq); else if (ioapic_get_vector(old_ioapic, old_pin) == - intr->Source) + intr->SourceIrq) ioapic_disable_pin(old_ioapic, old_pin); } @@ -680,31 +682,31 @@ madt_parse_interrupt_override(MADT_INTERRUPT_OVERRIDE *intr) * Parse an entry for an NMI routed to an IO APIC. */ static void -madt_parse_nmi(MADT_NMI_SOURCE *nmi) +madt_parse_nmi(ACPI_MADT_NMI_SOURCE *nmi) { void *ioapic; u_int pin; - if (madt_find_interrupt(nmi->Interrupt, &ioapic, &pin) != 0) { - printf("MADT: Could not find APIC for vector %d\n", - nmi->Interrupt); + if (madt_find_interrupt(nmi->GlobalIrq, &ioapic, &pin) != 0) { + printf("MADT: Could not find APIC for vector %u\n", + nmi->GlobalIrq); return; } ioapic_set_nmi(ioapic, pin); - if (nmi->TriggerMode != TRIGGER_CONFORMS) + if (!(nmi->IntiFlags & ACPI_MADT_TRIGGER_CONFORMS)) ioapic_set_triggermode(ioapic, pin, - interrupt_trigger(nmi->TriggerMode, 0)); - if (nmi->Polarity != TRIGGER_CONFORMS) + interrupt_trigger(nmi->IntiFlags, 0)); + if (!(nmi->IntiFlags & ACPI_MADT_TRIGGER_CONFORMS)) ioapic_set_polarity(ioapic, pin, - interrupt_polarity(nmi->Polarity, 0)); + interrupt_polarity(nmi->IntiFlags, 0)); } /* * Parse an entry for an NMI routed to a local APIC LVT pin. */ static void -madt_parse_local_nmi(MADT_LOCAL_APIC_NMI *nmi) +madt_parse_local_nmi(ACPI_MADT_LOCAL_APIC_NMI *nmi) { u_int apic_id, pin; @@ -712,8 +714,8 @@ madt_parse_local_nmi(MADT_LOCAL_APIC_NMI *nmi) apic_id = APIC_ID_ALL; else if (madt_find_cpu(nmi->ProcessorId, &apic_id) != 0) { if (bootverbose) - printf("MADT: Ignoring local NMI routed to ACPI CPU %u\n", - nmi->ProcessorId); + printf("MADT: Ignoring local NMI routed to " + "ACPI CPU %u\n", nmi->ProcessorId); return; } if (nmi->Lint == 0) @@ -721,31 +723,31 @@ madt_parse_local_nmi(MADT_LOCAL_APIC_NMI *nmi) else pin = LVT_LINT1; lapic_set_lvt_mode(apic_id, pin, APIC_LVT_DM_NMI); - if (nmi->TriggerMode != TRIGGER_CONFORMS) + if (!(nmi->IntiFlags & ACPI_MADT_TRIGGER_CONFORMS)) lapic_set_lvt_triggermode(apic_id, pin, - interrupt_trigger(nmi->TriggerMode, 0)); - if (nmi->Polarity != POLARITY_CONFORMS) + interrupt_trigger(nmi->IntiFlags, 0)); + if (!(nmi->IntiFlags & ACPI_MADT_POLARITY_CONFORMS)) lapic_set_lvt_polarity(apic_id, pin, - interrupt_polarity(nmi->Polarity, 0)); + interrupt_polarity(nmi->IntiFlags, 0)); } /* * Parse interrupt entries. */ static void -madt_parse_ints(APIC_HEADER *entry, void *arg __unused) +madt_parse_ints(ACPI_SUBTABLE_HEADER *entry, void *arg __unused) { switch (entry->Type) { - case APIC_XRUPT_OVERRIDE: + case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE: madt_parse_interrupt_override( - (MADT_INTERRUPT_OVERRIDE *)entry); + (ACPI_MADT_INTERRUPT_OVERRIDE *)entry); break; - case APIC_NMI: - madt_parse_nmi((MADT_NMI_SOURCE *)entry); + case ACPI_MADT_TYPE_NMI_SOURCE: + madt_parse_nmi((ACPI_MADT_NMI_SOURCE *)entry); break; - case APIC_LOCAL_NMI: - madt_parse_local_nmi((MADT_LOCAL_APIC_NMI *)entry); + case ACPI_MADT_TYPE_LOCAL_APIC_NMI: + madt_parse_local_nmi((ACPI_MADT_LOCAL_APIC_NMI *)entry); break; } } @@ -766,7 +768,7 @@ madt_set_ids(void *dummy) if (CPU_ABSENT(i)) continue; pc = pcpu_find(i); - KASSERT(pc != NULL, ("no pcpu data for CPU %d", i)); + KASSERT(pc != NULL, ("no pcpu data for CPU %u", i)); la = &lapics[pc->pc_apic_id]; if (!la->la_enabled) panic("APIC: CPU with APIC ID %u is not enabled", diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index f9277b8..dacde33 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -506,17 +506,12 @@ device tdfx_linux # Enable Linuxulator support # # ACPI_NO_SEMAPHORES makes the AcpiOs*Semaphore routines a no-op. # -# ACPICA_PEDANTIC enables strict checking of AML. Our default is to -# relax these checks to allow code generated by the Microsoft compiler -# to still execute. -# # Note that building ACPI into the kernel is deprecated; the module is # normally loaded automatically by the loader. device acpi options ACPI_DEBUG #!options ACPI_NO_SEMAPHORES -#!options ACPICA_PEDANTIC # ACPI Asus Desktop Extras. (voltage, temp, fan) device acpi_aiboost diff --git a/sys/i386/include/acpica_machdep.h b/sys/i386/include/acpica_machdep.h index 57d39cc..f90b213 100644 --- a/sys/i386/include/acpica_machdep.h +++ b/sys/i386/include/acpica_machdep.h @@ -34,7 +34,7 @@ *****************************************************************************/ #ifndef __ACPICA_MACHDEP_H__ -#define __ACPICA_MACHDEP_H__ +#define __ACPICA_MACHDEP_H__ #ifdef _KERNEL /* @@ -45,41 +45,43 @@ * ACPI_INTERNAL_XFACE - Internal ACPI interfaces * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces */ -#define ACPI_SYSTEM_XFACE -#define ACPI_EXTERNAL_XFACE -#define ACPI_INTERNAL_XFACE -#define ACPI_INTERNAL_VAR_XFACE +#define ACPI_SYSTEM_XFACE +#define ACPI_EXTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_VAR_XFACE /* Asm macros */ -#define ACPI_ASM_MACROS -#define BREAKPOINT3 -#define ACPI_DISABLE_IRQS() disable_intr() -#define ACPI_ENABLE_IRQS() enable_intr() +#define ACPI_ASM_MACROS +#define BREAKPOINT3 +#define ACPI_DISABLE_IRQS() disable_intr() +#define ACPI_ENABLE_IRQS() enable_intr() -#define ACPI_FLUSH_CPU_CACHE() wbinvd() +#define ACPI_FLUSH_CPU_CACHE() wbinvd() /* Section 5.2.9.1: global lock acquire/release functions */ extern int acpi_acquire_global_lock(uint32_t *lock); extern int acpi_release_global_lock(uint32_t *lock); -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ - ((Acq) = acpi_acquire_global_lock(GLptr)) -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ - ((Acq) = acpi_release_global_lock(GLptr)) +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) do { \ + (Acq) = acpi_acquire_global_lock(&((GLptr)->GlobalLock)); \ +} while (0) +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) do { \ + (Acq) = acpi_release_global_lock(&((GLptr)->GlobalLock)); \ +} while (0) /*! [Begin] no source code translation * * Math helper asm macros */ -#define asm __asm -#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ +#define asm __asm +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ asm("divl %2;" \ :"=a"(q32), "=d"(r32) \ :"r"(d32), \ "0"(n_lo), "1"(n_hi)) -#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ asm("shrl $1,%2;" \ "rcrl $1,%3;" \ :"=r"(n_hi), "=r"(n_lo) \ @@ -88,10 +90,10 @@ extern int acpi_release_global_lock(uint32_t *lock); /*! [End] no source code translation !*/ #endif /* _KERNEL */ -#define ACPI_MACHINE_WIDTH 32 -#define COMPILER_DEPENDENT_INT64 long long -#define COMPILER_DEPENDENT_UINT64 unsigned long long -#define ACPI_USE_NATIVE_DIVIDE +#define ACPI_MACHINE_WIDTH 32 +#define COMPILER_DEPENDENT_INT64 long long +#define COMPILER_DEPENDENT_UINT64 unsigned long long +#define ACPI_USE_NATIVE_DIVIDE void acpi_SetDefaultIntrModel(int model); void acpi_cpu_c1(void); |