Date: Thu, 29 Jan 2004 23:30:47 -0500 From: Alexandre "Sunny" Kovalenko <Alex.Kovalenko@verizon.net> To: freebsd-current@freebsd.org Subject: Re: TP 600 and ACPI IRQ routing problems Message-ID: <20040129233047.62e4c857.Alex.Kovalenko@verizon.net> In-Reply-To: <20040129192743.GC75575@mail.evip.pl> References: <20040129182233.GB75575@mail.evip.pl> <200401291342.41748.jhb@FreeBSD.org> <20040129192743.GC75575@mail.evip.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] You can try attached patch and set hw.acpi.pci.preferred_irq=<whatever IRQ you have configured for your PCI> in your /boot/loader.conf. That worked for me in somewhat similar situation on ThinkPad 560Z. If it worked for you, you might want report details to John Baldwin, since I have retired my 560Z and, consequently could not troubleshoot this problem any further. On Thu, 29 Jan 2004 20:27:43 +0100 Wiktor Niesiobedzki <bsd@w.evip.pl> wrote: > On Thu, Jan 29, 2004 at 01:42:41PM -0500, John Baldwin wrote: > > On Thursday 29 January 2004 01:22 pm, Wiktor Niesiobedzki wrote: > > > Hi, > > > > > > After giving a shot yesterdays CURRENT I still can't get ACPI and PCCARD > > > cooperating on my Thinkpad 600. As far as I recognize the problem, it lies > > > in that acpi assignes irq 3 to cbb device, what apparently isn't the best > > > choice. I've tried following setting in loader.conf: > > > hw.acpi.pci.link.0.3.0.irq=9 > > > hw.acpi.pci.link.0.7.3.irq=10 > > > hw.acpi.pci.link.0.2.0.irq=11 > > > hw.acpi.pci.link.0.2.1.irq=10 > > > > Try without that first line. (The irq=9 one). > > > No luck, still everything gets routed to irq 3. > > Cheers, > > Wiktor Niesiobedzki > > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" -- Alexandre "Sunny" Kovalenko. [-- Attachment #2 --] --- acpi_pcib.c Mon Nov 24 21:24:16 2003 +++ acpi_pcib.c.NEW Mon Nov 24 21:23:59 2003 @@ -324,6 +324,48 @@ printf(" %d", Interrupts[i]); printf("\n"); + /*************************************************************/ + /* This is the ugly hack to see if it will be working at all */ + /* We will look for environment variable 'hw.acpi.pci.preferred_irq' + * then check if IRQ in question is in the list of available ones + * and if it is available, we will use it. If it is not available + * we will fall back on "unscientific" first available interrupt + * (basically the way code worked before). + */ + int preferred_irq_idx = 0; + char *pPreferredIRQ = getenv("hw.acpi.pci.preferred_irq"); + if(pPreferredIRQ != NULL) + { + register char *pc; + /* I'm sure there is a better way ;) */ + /* strlen + isdigit */ + register int irq = 0; + for(pc = pPreferredIRQ; *pc != '\0'; pc++) + { + if((*pc < '0') || (*pc > '9')) + { + device_printf(pcib, "Invalid preferred IRQ: %s, " + "falling back on first available\n", + pPreferredIRQ); + goto fallBackOnZero; + } + irq = (irq << 3) + (irq << 1) + (*pc - '0'); + } + /* Looking for slot with the IRQ in question */ + for(register int i = 0; i < NumberOfInterrupts; i++) + { + if(Interrupts[i] == irq) + { + preferred_irq_idx = i; + break; + } + } + device_printf(pcib, "User suggested IRQ: %d (slot %d)\n", + irq, preferred_irq_idx); + } + fallBackOnZero: + /*************************************************************/ + if (crsbuf.Pointer != NULL) /* should never happen */ AcpiOsFree(crsbuf.Pointer); crsbuf.Pointer = NULL; @@ -332,29 +374,29 @@ resbuf.Length = ACPI_SIZEOF_RESOURCE(ACPI_RESOURCE_IRQ); resbuf.Data.Irq = prsres->Data.Irq; /* structure copy other fields */ resbuf.Data.Irq.NumberOfInterrupts = 1; - resbuf.Data.Irq.Interrupts[0] = Interrupts[0]; /* just take first... */ + resbuf.Data.Irq.Interrupts[0] = Interrupts[preferred_irq_idx]; /* just take first... */ } else { resbuf.Id = ACPI_RSTYPE_EXT_IRQ; resbuf.Length = ACPI_SIZEOF_RESOURCE(ACPI_RESOURCE_IRQ); resbuf.Data.ExtendedIrq = prsres->Data.ExtendedIrq; /* structure copy other fields */ resbuf.Data.ExtendedIrq.NumberOfInterrupts = 1; - resbuf.Data.ExtendedIrq.Interrupts[0] = Interrupts[0]; /* just take first... */ + resbuf.Data.ExtendedIrq.Interrupts[0] = Interrupts[preferred_irq_idx]; /* just take first... */ } if (ACPI_FAILURE(status = acpi_AppendBufferResource(&crsbuf, &resbuf))) { device_printf(pcib, "couldn't route interrupt %d via %s, interrupt resource build failed - %s\n", - Interrupts[0], acpi_name(lnkdev), AcpiFormatException(status)); + Interrupts[preferred_irq_idx], acpi_name(lnkdev), AcpiFormatException(status)); goto out; } if (ACPI_FAILURE(status = AcpiSetCurrentResources(lnkdev, &crsbuf))) { device_printf(pcib, "couldn't route interrupt %d via %s - %s\n", - Interrupts[0], acpi_name(lnkdev), AcpiFormatException(status)); + Interrupts[preferred_irq_idx], acpi_name(lnkdev), AcpiFormatException(status)); goto out; } /* successful, return the interrupt we just routed */ device_printf(pcib, "slot %d INT%c routed to irq %d via %s\n", - pci_get_slot(dev), 'A' + pin, Interrupts[0], acpi_name(lnkdev)); - interrupt = Interrupts[0]; + pci_get_slot(dev), 'A' + pin, Interrupts[preferred_irq_idx], acpi_name(lnkdev)); + interrupt = Interrupts[preferred_irq_idx]; out: if (crsbuf.Pointer != NULL)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040129233047.62e4c857.Alex.Kovalenko>
