summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_pcib.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-11-14 21:36:09 +0000
committerjhb <jhb@FreeBSD.org>2003-11-14 21:36:09 +0000
commita8b3e2b2efc31b02082a0211f65d2d17b7180124 (patch)
tree90ee6f27f6f54b8c81fd27e33b8bceca6a60d4ae /sys/dev/acpica/acpi_pcib.c
parent29faf9e47052f4559ee204783d6091f63361d8ca (diff)
downloadFreeBSD-src-a8b3e2b2efc31b02082a0211f65d2d17b7180124.zip
FreeBSD-src-a8b3e2b2efc31b02082a0211f65d2d17b7180124.tar.gz
Improve support for extended IRQ resources:
- For acpi_pci_link_entry_dump(), add a few helper functions to display the trigger mode, polarity, and sharemode of an individual IRQ resource. These functions are then called for both regular and extended IRQ resources. - In acpi_pci_link_set_irq(), use the same type of IRQ resource (regular vs. extended) for the new current resource as the type of the resources from _PRS. - When routing an interrupt don't ignore extended IRQ resources. Also, use the same type of IRQ resource (regular vs. extended) for the new current resource when as the type of the resource from _PRS. Tested by: peter
Diffstat (limited to 'sys/dev/acpica/acpi_pcib.c')
-rw-r--r--sys/dev/acpica/acpi_pcib.c67
1 files changed, 47 insertions, 20 deletions
diff --git a/sys/dev/acpica/acpi_pcib.c b/sys/dev/acpica/acpi_pcib.c
index ab721df..731b040 100644
--- a/sys/dev/acpica/acpi_pcib.c
+++ b/sys/dev/acpica/acpi_pcib.c
@@ -118,6 +118,8 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin,
ACPI_DEVICE_INFO devinfo;
ACPI_BUFFER buf = {sizeof(devinfo), &devinfo};
ACPI_STATUS status;
+ UINT32 NumberOfInterrupts;
+ UINT32 *Interrupts;
u_int8_t *prtp;
int interrupt;
int i;
@@ -234,16 +236,25 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin,
}
/* type-check the resource we've got */
- if (crsres->Id != ACPI_RSTYPE_IRQ) { /* XXX ACPI_RSTYPE_EXT_IRQ */
+ if (crsres->Id != ACPI_RSTYPE_IRQ && crsres->Id != ACPI_RSTYPE_EXT_IRQ) {
device_printf(pcib, "_CRS resource entry has unsupported type %d\n",
crsres->Id);
goto out;
}
+ /* set variables based on resource type */
+ if (crsres->Id == ACPI_RSTYPE_IRQ) {
+ NumberOfInterrupts = crsres->Data.Irq.NumberOfInterrupts;
+ Interrupts = crsres->Data.Irq.Interrupts;
+ } else {
+ NumberOfInterrupts = crsres->Data.ExtendedIrq.NumberOfInterrupts;
+ Interrupts = crsres->Data.ExtendedIrq.Interrupts;
+ }
+
/* if there's more than one interrupt, we are confused */
- if (crsres->Data.Irq.NumberOfInterrupts > 1) {
+ if (NumberOfInterrupts > 1) {
device_printf(pcib, "device has too many interrupts (%d)\n",
- crsres->Data.Irq.NumberOfInterrupts);
+ NumberOfInterrupts);
goto out;
}
@@ -255,10 +266,10 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin,
*
* XXX check ASL examples to see if this is an acceptable set of tests
*/
- if ((crsres->Data.Irq.NumberOfInterrupts == 1) && (crsres->Data.Irq.Interrupts[0] != 0)) {
+ if ((NumberOfInterrupts == 1) && (Interrupts[0] != 0)) {
device_printf(pcib, "slot %d INT%c is routed to irq %d\n",
- pci_get_slot(dev), 'A' + pin, crsres->Data.Irq.Interrupts[0]);
- interrupt = crsres->Data.Irq.Interrupts[0];
+ pci_get_slot(dev), 'A' + pin, Interrupts[0]);
+ interrupt = Interrupts[0];
goto out;
}
@@ -276,14 +287,23 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin,
}
/* type-check the resource we've got */
- if (prsres->Id != ACPI_RSTYPE_IRQ) { /* XXX ACPI_RSTYPE_EXT_IRQ */
+ if (prsres->Id != ACPI_RSTYPE_IRQ || prsres->Id != ACPI_RSTYPE_EXT_IRQ) {
device_printf(pcib, "_PRS resource entry has unsupported type %d\n",
prsres->Id);
goto out;
}
+ /* 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 (prsres->Data.Irq.NumberOfInterrupts < 1) {
+ if (NumberOfInterrupts < 1) {
device_printf(pcib, "device has no interrupts\n");
goto out;
}
@@ -300,34 +320,41 @@ acpi_pcib_route_interrupt(device_t pcib, device_t dev, int pin,
* new interrupt.
*/
device_printf(pcib, "possible interrupts:");
- for (i = 0; i < prsres->Data.Irq.NumberOfInterrupts; i++)
- printf(" %d", prsres->Data.Irq.Interrupts[i]);
+ for (i = 0; i < NumberOfInterrupts; i++)
+ printf(" %d", Interrupts[i]);
printf("\n");
if (crsbuf.Pointer != NULL) /* should never happen */
AcpiOsFree(crsbuf.Pointer);
crsbuf.Pointer = NULL;
- resbuf.Id = ACPI_RSTYPE_IRQ;
- 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] = prsres->Data.Irq.Interrupts[0]; /* just take first... */
+ if (prsres->Id == ACPI_RSTYPE_IRQ) {
+ resbuf.Id = ACPI_RSTYPE_IRQ;
+ 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... */
+ } 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... */
+ }
if (ACPI_FAILURE(status = acpi_AppendBufferResource(&crsbuf, &resbuf))) {
device_printf(pcib, "couldn't route interrupt %d via %s, interrupt resource build failed - %s\n",
- prsres->Data.Irq.Interrupts[0], acpi_name(lnkdev), AcpiFormatException(status));
+ Interrupts[0], 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",
- prsres->Data.Irq.Interrupts[0], acpi_name(lnkdev), AcpiFormatException(status));
+ Interrupts[0], 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, prsres->Data.Irq.Interrupts[0],
- acpi_name(lnkdev));
- interrupt = prsres->Data.Irq.Interrupts[0];
+ pci_get_slot(dev), 'A' + pin, Interrupts[0], acpi_name(lnkdev));
+ interrupt = Interrupts[0];
out:
if (crsbuf.Pointer != NULL)
OpenPOWER on IntegriCloud