summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_pcib.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2004-03-20 20:47:08 +0000
committernjl <njl@FreeBSD.org>2004-03-20 20:47:08 +0000
commitf80c9bf83353896b47b57a0d4c0c1023aa72ee42 (patch)
tree3dd3d8c17aa864aa64f223d74c054abc72d6b512 /sys/dev/acpica/acpi_pcib.c
parent7e4265388d8a0551f21d82466d57a3248412de83 (diff)
downloadFreeBSD-src-f80c9bf83353896b47b57a0d4c0c1023aa72ee42.zip
FreeBSD-src-f80c9bf83353896b47b57a0d4c0c1023aa72ee42.tar.gz
Fix loop termination condition for parsing resources in _PRS buffers.
This completes the effort to handle dependent functions, which are used in some machines for irq link resources. Also, clean up some nearby comments while I'm at it.
Diffstat (limited to 'sys/dev/acpica/acpi_pcib.c')
-rw-r--r--sys/dev/acpica/acpi_pcib.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/sys/dev/acpica/acpi_pcib.c b/sys/dev/acpica/acpi_pcib.c
index 3bf39c7..9acdf8b 100644
--- a/sys/dev/acpica/acpi_pcib.c
+++ b/sys/dev/acpica/acpi_pcib.c
@@ -281,10 +281,11 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin,
/*
* There isn't an interrupt, so we have to look at _PRS to get one.
- * Get the set of allowed interrupts from the _PRS resource indexed by SourceIndex.
+ * Get the set of allowed interrupts from the _PRS resource indexed
+ * by SourceIndex.
*/
if (prsbuf.Pointer == NULL) {
- device_printf(pcib, "device has no routed interrupt and no _PRS on PCI interrupt link device\n");
+ device_printf(pcib, "no routed irq and no _PRS on irq link device\n");
goto out;
}
@@ -294,16 +295,23 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin,
* future, we might use these for priority but this is good enough for
* now until BIOS vendors actually mean something by using them.
*/
- for (i = prt->SourceIndex; ; i++) {
+ prsres = NULL;
+ for (i = prt->SourceIndex; prsres == NULL; i++) {
if (ACPI_FAILURE(acpi_FindIndexedResource(&prsbuf, i, &prsres))) {
device_printf(pcib, "_PRS lacks IRQ resource, routing failed\n");
goto out;
}
switch (prsres->Id) {
case ACPI_RSTYPE_IRQ:
+ NumberOfInterrupts = prsres->Data.Irq.NumberOfInterrupts;
+ Interrupts = prsres->Data.Irq.Interrupts;
+ break;
case ACPI_RSTYPE_EXT_IRQ:
+ NumberOfInterrupts = prsres->Data.ExtendedIrq.NumberOfInterrupts;
+ Interrupts = prsres->Data.ExtendedIrq.Interrupts;
break;
case ACPI_RSTYPE_START_DPF:
+ prsres = NULL;
continue;
default:
device_printf(pcib, "_PRS has invalid type %d\n", prsres->Id);
@@ -311,15 +319,6 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin,
}
}
- /* set variables based on resource type */
- if (prsres->Id == ACPI_RSTYPE_IRQ) {
- NumberOfInterrupts = prsres->Data.Irq.NumberOfInterrupts;
- Interrupts = prsres->Data.Irq.Interrupts;
- } else {
- NumberOfInterrupts = prsres->Data.ExtendedIrq.NumberOfInterrupts;
- Interrupts = prsres->Data.ExtendedIrq.Interrupts;
- }
-
/* there has to be at least one interrupt available */
if (NumberOfInterrupts < 1) {
device_printf(pcib, "device has no interrupts\n");
@@ -327,15 +326,15 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin,
}
/*
- * Pick an interrupt to use. Note that a more scientific approach than just
- * taking the first one available would be desirable.
+ * Pick an interrupt to use. Note that a more scientific approach than
+ * just taking the first one available would be desirable.
*
- * The PCI BIOS $PIR table offers "preferred PCI interrupts", but ACPI doesn't
- * seem to offer a similar mechanism, so picking a "good" interrupt here is a
- * difficult task.
+ * The PCI BIOS $PIR table offers "preferred PCI interrupts", but ACPI
+ * doesn't seem to offer a similar mechanism, so picking a "good"
+ * interrupt here is a difficult task.
*
- * Build a resource buffer and pass it to AcpiSetCurrentResources to route the
- * new interrupt.
+ * Build a resource buffer and pass it to AcpiSetCurrentResources to
+ * route the new interrupt.
*/
device_printf(pcib, "possible interrupts:");
for (i = 0; i < NumberOfInterrupts; i++)
OpenPOWER on IntegriCloud