summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/intel/common/block/include/intelblocks/irq.h5
-rw-r--r--src/soc/intel/common/block/irq/irq.c15
2 files changed, 19 insertions, 1 deletions
diff --git a/src/soc/intel/common/block/include/intelblocks/irq.h b/src/soc/intel/common/block/include/intelblocks/irq.h
index 4a7a13bee0..33c9b7e7ac 100644
--- a/src/soc/intel/common/block/include/intelblocks/irq.h
+++ b/src/soc/intel/common/block/include/intelblocks/irq.h
@@ -7,6 +7,7 @@
#include <types.h>
#define MAX_FNS 8
+#define INVALID_IRQ -1
#define ANY_PIRQ(x) [PCI_FUNC(x)] = { .fixed_int_pin = PCI_INT_NONE,\
.fixed_pirq = PIRQ_INVALID, \
@@ -61,4 +62,8 @@ bool irq_program_non_pch(void);
const struct pci_irq_entry *get_cached_pci_irqs(void);
+/* Search the cached PCI IRQ assignment results for the matching devfn and
+ return the corresponding IRQ, or INVALID_IRQ if not found. */
+int get_pci_devfn_irq(unsigned int devfn);
+
#endif /* SOC_INTEL_COMMON_IRQ_H */
diff --git a/src/soc/intel/common/block/irq/irq.c b/src/soc/intel/common/block/irq/irq.c
index b3f5c73b38..f0892a988c 100644
--- a/src/soc/intel/common/block/irq/irq.c
+++ b/src/soc/intel/common/block/irq/irq.c
@@ -21,7 +21,6 @@
#define IDX2PIN(i) (enum pci_pin)((i) + PCI_INT_A)
#define PIN2IDX(p) (size_t)((p) - PCI_INT_A)
-#define INVALID_IRQ -1
struct pin_info {
enum pin_state {
@@ -429,3 +428,17 @@ bool irq_program_non_pch(void)
return true;
}
+
+int get_pci_devfn_irq(unsigned int devfn)
+{
+ const struct pci_irq_entry *entry = cached_entries;
+
+ while (entry) {
+ if (entry->devfn == devfn)
+ return entry->irq;
+
+ entry = entry->next;
+ }
+
+ return INVALID_IRQ;
+}