Port-i386 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

PCI interrupts, IOAPIC and ACPI woes: modify the DSDT or apply a patch to mpacpi.c?



I have board with _PRT entries in the ACPI configuration which do not
make much sense to me - I'm not completely sure if they are wrong, but
the net effect is that if both ACPI and the IOAPIC are enabled, devices
on the secondary IDE channel can't be used, because IRQ 15 is not
properly routed.

Specifically, the third PCI bus has _PRT entries like these which apply
when the IOAPIC is enabled:

                Package(0x4) {
                    0x0003ffff,  /* Address */
                    0x1,         /* Pin */
                    0x0,         /* Source */
                    0xf,         /* SourceIndex */
                },
                Package(0x4) {
                    0x0003ffff,
                    0x2,
                    0x0,
                    0xf,
                },
                Package(0x4) {
                    0x0003ffff,
                    0x3,
                    0x0,
                    0xf,
                },

Apart from the fact that there is no device 3 on that bus (which also
makes these entries seem weird), the real problem is caused by the
SourceIndex entries with the value 0xf - that's global irq 15. mpacpi.c
will then configure this IRQ as active low, which effectively disables
devices on the secondary IDE channel ("lost interrupt" timeouts).

What's the best way to deal with this issue? Fix my DSDT and use
ACPI_DSDT_OVERRIDE, or would the attached diff for mpacpi.c also be an
acceptable solution (making it more robust when dealing with bogus _PRT
entries)...? I've tested the latter with 4.99.66, and it does the trick
for me. Of course I'll gladly provide more information about my
configuration etc., if it's considered useful - just let me know.

Thanks,
Kaspar




Index: sys/arch/x86/x86/mpacpi.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/x86/mpacpi.c,v
retrieving revision 1.63
diff -u -p -r1.63 mpacpi.c
--- sys/arch/x86/x86/mpacpi.c   6 Jun 2008 20:34:24 -0000       1.63
+++ sys/arch/x86/x86/mpacpi.c   23 Jun 2008 16:46:21 -0000
@@ -799,12 +799,14 @@ mpacpi_pciroute(struct mpacpi_pcibus *mp
                        pic = intr_findpic(ptrp->SourceIndex);
                        if (pic == NULL)
                                continue;
+                       pin = ptrp->SourceIndex - pic->pic_vecbase;
+                       if (pin < NUM_LEGACY_IRQS)
+                               continue;
                        /* Defaults for PCI (active low, level triggered) */
                        mpi->redir =
                            (IOAPIC_REDLO_DEL_FIXED<<IOAPIC_REDLO_DEL_SHIFT) |
                            IOAPIC_REDLO_LEVEL | IOAPIC_REDLO_ACTLO;
                        mpi->ioapic = pic;
-                       pin = ptrp->SourceIndex - pic->pic_vecbase;
                        if (pic->pic_type == PIC_I8259 && pin > 15)
                                panic("bad pin %d for legacy IRQ", pin);
                        mpi->ioapic_pin = pin;




Home | Main Index | Thread Index | Old Index