static_allocator/intx: parse INTx allocated by another device

The interrupt pin descriptors in board XML follows the same notation as in
ACPI PRT (PCI Routing Table), i.e. either an integer or a pair of a device
object and an index.

However, the current static INTx allocator recognizes
integer-as-interrupt-line only, which will cause build-time failure if
the "device object + index" notation is used in physical DSDT to describe
PCI interrupt pin routing.

This patch refines the static allocator so that both notations can be
parsed properly. In case an interrupt line descriptor in the board XML
refers to an device object without an index, it is interpreted as the first
of the ACPI device object if it is an interrupt resource.

Tracked-On: #7058
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Junjie Mao 2022-01-25 21:13:59 +08:00 committed by acrnsi-robot
parent ed06539aae
commit cbd593e6c0

View File

@ -104,9 +104,17 @@ def get_irqs_of_device(device_node):
# PCI interrupt pin
for res in device_node.xpath("resource[@type='interrupt_pin']"):
irq = res.get("source", None)
if irq is not None:
irqs.add(int(irq))
source = res.get("source", None)
if source is not None:
if source.isdigit():
# Interrupts from the global interrupt pool
irqs.add(int(source))
else:
# Interrupts from another device
index = res.get("index", "0")
irq = common.get_node(f"//device[acpi_object='{source}']/resource[@id='res{index}' and @type='irq']/@int", device_node.getroottree())
if irq is not None:
irqs.add(int(irq))
return irqs