Subject: Re: port-i386/35618: ioapic hangs a kernel boot
To: None <gnats-bugs@netbsd.org>
From: Cherry G. Mathew <cherry.g.mathew@gmail.com>
List: netbsd-bugs
Date: 02/25/2007 10:45:28
On 2/15/07, Bernd Ernesti <pr200701@veego.de> wrote:
> >Number:         35618
> >Category:       port-i386
> >Synopsis:       ioapic hangs a kernel boot
> >Confidential:   no
> >Severity:       non-critical
> >Priority:       high
> >Responsible:    port-i386-maintainer
> >State:          open
> >Class:          sw-bug
> >Submitter-Id:   net
> >Arrival-Date:   Thu Feb 15 22:15:00 +0000 2007
> >Originator:     Bernd Ernesti
> >Release:        NetBSD 4.99.7
> >Organization:
> >Environment:
> System: NetBSD 4.99.7
> Architecture: i386
> Machine: i386
> >Description:
>         The kernel stops after printing the "ioapic0: enabling" line.
>         Btw, there is no manpage about ioapic.
>
> >How-To-Repeat:
>         Compile an ACPI kernel with "ioapic* at mainbus? apid?" and notice
>         that it stops after the "ioapic0: enabling" output.
>         e.g. GENERIC.MPACPI
>
>         An older kernel (<3.99.22) or a kernel without ioapic doesn't stop.
>
>         This is an Gigabyte GA-K8NSC-939 board.
>         dmesg log of the last working kernel before the changes mentioning
>         below and an acpi dump can be found on ftp.netbsd.org:~veego/tmp/k8nsc/
>
>         I could pin it down to the following source changes where this problem
>         started:
>
> Module Name:    src
> Committed By:   christos
> Date:           Tue Jul  4 00:30:24 UTC 2006
>
> Modified Files:
>         src/sys/arch/amd64/amd64: mainbus.c
>         src/sys/arch/amd64/conf: GENERIC GENERIC_ACPI INSTALL_ACPI
>         src/sys/arch/i386/conf: GENERIC GENERIC.MP GENERIC.MPACPI INSTALL.MP
>             VIRTUALPC
>         src/sys/arch/i386/i386: mainbus.c
>         src/sys/arch/x86/conf: files.x86
>         src/sys/arch/x86/include: intr.h mpacpi.h mpbiosvar.h mpconfig.h pic.h
>         src/sys/arch/x86/pci: pci_intr_machdep.c pci_machdep.c
>         src/sys/arch/x86/x86: acpi_machdep.c i8259.c intr.c ioapic.c mpacpi.c
>             mpbios.c
>         src/sys/dev/acpi: acpi.c acpi_quirks.c acpivar.h files.acpi
>         src/sys/dev/pci: pccbb.c
> Added Files:
>         src/sys/dev/acpi: acpi_pci_link.c
>
> Log Message:
> Apply fvdl's acpi pci interrupt configuration code.
> - MPACPI is no more.
> - MPACPI_SCANPCI -> ACPI_SCANPCI
>
> >Fix:
>
>

Possible fix below.

--- acpi_machdep.c.~1.13.~      2007-02-22 02:00:50.000000000 +0000
+++ acpi_machdep.c      2007-02-25 01:34:09.000000000 +0000
@@ -152,7 +152,7 @@
       for (i = 0; i < mp_nbus; i++) {
               for (mip = mp_busses[i].mb_intrs; mip != NULL;
                    mip = mip->next) {
-                       if (mip->global_int == (int)InterruptNumber) {
+                       if (mip->bus_pin  == (int)InterruptNumber) {
                               h = mip->ioapic_ih;
                               if (APIC_IRQ_ISLEGACY(h)) {
                                       irq = APIC_IRQ_LEGACY_IRQ(h);
@@ -213,6 +213,7 @@
               mip->flags &= ~3;
               mip->flags |= MPS_INTPO_ACTLO;
               mip->redir |= IOAPIC_REDLO_ACTLO;
+               pin = mip->bus_pin;
       }
 #endif


-- 
~Cherry