Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Nov 2004 10:50:53 -0500
From:      John Baldwin <jhb@FreeBSD.org>
To:        freebsd-acpi@FreeBSD.org
Cc:        acpi@FreeBSD.org
Subject:   Re: ASUS P5A broken by ACPI black-list
Message-ID:  <200411301050.53981.jhb@FreeBSD.org>
In-Reply-To: <20041127223609.BB2DA5D04@ptavv.es.net>
References:  <20041127223609.BB2DA5D04@ptavv.es.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Saturday 27 November 2004 05:36 pm, Kevin Oberman wrote:
> > From: John Baldwin <jhb@FreeBSD.org>
> > Date: Mon, 22 Nov 2004 08:45:56 -0500
> >
> > On Nov 20, 2004, at 7:15 PM, Kevin Oberman wrote:
> > >> From: John Baldwin <jhb@FreeBSD.org>
> > >> Date: Thu, 4 Nov 2004 17:30:04 -0500
> > >>
> > >> On Thursday 04 November 2004 05:23 pm, Kevin Oberman wrote:
> > >>>> From: John Baldwin <jhb@FreeBSD.org>
> > >>>> Date: Mon, 1 Nov 2004 17:48:25 -0500
> > >>>>
> > >>>> On Wednesday 06 October 2004 01:20 pm, John Baldwin wrote:
> > >>>>> Ok, well, it seems your BIOS is too busted for non-ACPI to work
> > >>>>> out of
> > >>>>> the box, you can try setting a hint to force the link for your
> > >>>>> sound
> > >>>>> card to use IRQ 6.  Something like 'set hw.pci.link.0x4.irq=6', or
> > >>>>> maybe 'hw.pci.link.0x04.irq' if that doesn't work.
> > >>>>
> > >>>> Actually, the $PIR code won't let you use an invalid IRQ currently,
> > >>>> but
> > >>>> this patch lets it do so.  I'm curious if you could try booting
> > >>>> with this
> > >>>> patch with ACPI disabled and using an appropriate tunable (such as
> > >>>> 'hw.pci.link.0x4.irq=6') to route your links the way ACPI likes them
> > >>>> routed. If this does work, I'd like to try another patch as well
> > >>>> that
> > >>>> would help it to work out-of-the-box for the non-ACPI case.  Thanks.
> > >>>
> > >>> John,
> > >>>
> > >>> I have not forgotten this, but remote testing when re-boots are
> > >>> required
> > >>> is a bit difficult. My wife helped me a bit yesterday, but she is a
> > >>> Solaris type and I need to step her through things command by
> > >>> command,
> > >>> so it's a bit tedious.
> > >>
> > >> That's ok, take your time, this isn't super critical.
> > >
> > > O.K. I tried the loadable (hw.pci.link.0x4.irq="6"), but it still did
> > > not work. I got the expected message:
> > > $PIR: BIOS IRQ 6 for 0.9.INTA is not valid for link 0x4
> > > but still no interrupts from the network card.
> >
> > Well, the patch doesn't fix that message, but it should let the override
> > you add from the loader work.  If your system does end up working ok
> > I'll
> > come up with another patch that will trust what your BIOS says over what
> >   the $PIR says.
> >
> > > Both the network card and the sound card claim to be using the
> > > specified
> > > IRQ (I tried both 6 and 10):
> > > pcm0: <AudioPCI ES1373-8> port 0xd800-0xd83f irq 6 at device 9.0 on
> > > pci0
> > > xl0: <3Com 3c905B-TX Fast Etherlink XL> port 0xd400-0xd47f mem
> > > 0xde000000-0xde00007f irq 10 at device 11.0 on pci0
> > > but 'vmstat -i' did not list IRQ6 as being in use.
> >
> > Well, if the device gets the IRQ, then that means the patch worked. :)
> > Does the sound card actually work now?  Note that IRQ6 won't show up in
> > vmstat -i until the device actually interrupts.
>
> The correct IRQ shows up during the device probe at boot, but neither the
> sound card nor the network card actually works. It seems like the IRQ
> assignment is understood at the device probe, but the interrupt never
> actually get routed. My BIOS may simply be toast.

Odd.  Maybe it's because we specifically route the IRQ that this happens?

> There is a beta BIOS version available and I have been thinking about
> installing it as Ruslan tells me it fixes the ACPI timer problem, but I
> was hoping to figure out a way to get the released BIOS to work better
> so others can have an easier time going to V5. I suspect a lot of ASUS
> P5A and P5B cards are still out there and booting in SAFE mode won't
> work for them at this time. I don't know if the beta BIOS helps the
> IRQ issue.
>
> I get nervous flashing BIOS, so I don't want to jump back and
> forth. Since Nate adjusted ACPI to just disable the timer and not all of
> ACPI, the board boots fine with ACPI, so it's not a big issue for
> me. Just trying to help if you are interested.
>
> Let me know if there is anything else you would like me to try.

Yes, I've tweaked the code further now so that it will allow invalid IRQs if 
the BIOS uses them.  This should use IRQ6 without needing to set the hint and 
might even work since it won't try to reroute the IRQ:

--- //depot/vendor/freebsd/src/sys/i386/pci/pci_pir.c	2004/07/01 07:50:36
+++ //depot/user/jhb/acpipci/i386/pci/pci_pir.c	2004/11/22 19:28:47
@@ -324,22 +324,50 @@
 	pin = intpin - entry->pe_intpin;
 	pci_link = pci_pir_find_link(intpin->link);
 	irq = pci_pir_search_irq(entry->pe_bus, entry->pe_device, pin);
-	if (irq == PCI_INVALID_IRQ)
+	if (irq == PCI_INVALID_IRQ || irq == pci_link->pl_irq)
 		return;
-	if (pci_pir_valid_irq(pci_link, irq)) {
-		if (pci_link->pl_irq == PCI_INVALID_IRQ) {
-			pci_link->pl_irq = irq;
-			pci_link->pl_routed = 1;
-		} else if (pci_link->pl_irq != irq)
+
+	/*
+	 * If we don't have an IRQ for this link yet, then we trust the
+	 * BIOS, even if it seems invalid from the $PIR entries.
+	 */
+	if (pci_link->pl_irq == PCI_INVALID_IRQ) {
+		if (!pci_pir_valid_irq(pci_link, irq))
 			printf(
-	"$PIR: BIOS IRQ %d for %d.%d.INT%c does not match link %#x irq %d\n",
+	"$PIR: Using invalid BIOS IRQ %d from %d.%d.INT%c is for link %#x\n",
 			    irq, entry->pe_bus, entry->pe_device, pin + 'A',
-			    pci_link->pl_id, pci_link->pl_irq);
-	} else
+			    pci_link->pl_id);
+		pci_link->pl_irq = irq;
+		pci_link->pl_routed = 1;
+		return;
+	}
+
+	/*
+	 * We have an IRQ and it doesn't match the current IRQ for this
+	 * link.  If the new IRQ is invalid, then warn about it and ignore
+	 * it.  If the old IRQ is invalid and the new IRQ is valid, then
+	 * prefer the new IRQ instead.  If both IRQs are valid, then just
+	 * use the first one.  Note that if we ever get into this situation
+	 * we are having to guess which setting the BIOS actually routed.
+	 * Perhaps we should just give up instead.
+	 */
+	if (!pci_pir_valid_irq(pci_link, irq)) {
 		printf(
 		"$PIR: BIOS IRQ %d for %d.%d.INT%c is not valid for link %#x\n",
 		    irq, entry->pe_bus, entry->pe_device, pin + 'A',
 		    pci_link->pl_id);
+	} else if (!pci_pir_valid_irq(pci_link, pci_link->pl_irq)) {
+		printf(
+"$PIR: Preferring valid BIOS IRQ %d from %d.%d.INT%c for link %#x to IRQ 
%d\n", 
+		    irq, entry->pe_bus, entry->pe_device, pin + 'A',
+		    pci_link->pl_id, pci_link->pl_irq);
+		pci_link->pl_irq = irq;
+		pci_link->pl_routed = 1;
+	} else
+		printf(
+	"$PIR: BIOS IRQ %d for %d.%d.INT%c does not match link %#x irq %d\n",
+		    irq, entry->pe_bus, entry->pe_device, pin + 'A',
+		    pci_link->pl_id, pci_link->pl_irq);
 }
 
 /*
@@ -386,9 +414,9 @@
 	}
 
 	/*
-	 * Allow the user to override the IRQ for a given link device as
-	 * long as the override is valid or is 255 or 0 to clear a preset
-	 * IRQ.
+	 * Allow the user to override the IRQ for a given link device.  We
+	 * allow invalid IRQs to be specified but warn about them.  An IRQ
+	 * of 255 or 0 clears any preset IRQ.
 	 */
 	i = 0;
 	TAILQ_FOREACH(pci_link, &pci_links, pl_links) {
@@ -398,12 +426,14 @@
 			continue;
 		if (irq == 0)
 			irq = PCI_INVALID_IRQ;
-		if (irq == PCI_INVALID_IRQ ||
-		    pci_pir_valid_irq(pci_link, irq)) {
-			pci_link->pl_routed = 0;
-			pci_link->pl_irq = irq;
-			i = 1;
-		}
+		if (irq != PCI_INVALID_IRQ &&
+		    !pci_pir_valid_irq(pci_link, irq) && bootverbose)
+			printf(
+		"$PIR: Warning, IRQ %d for link %#x is not listed as valid\n",
+			    irq, pci_link->pl_id);
+		pci_link->pl_routed = 0;
+		pci_link->pl_irq = irq;
+		i = 1;
 	}
 	if (bootverbose && i) {
 		printf("$PIR: Links after tunable overrides:\n");

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411301050.53981.jhb>