Patchwork seabios: Add a dummy PCI slot to irq mapping function

login
register
mail settings
Submitter Alex Williamson
Date Feb. 21, 2013, 4:12 p.m.
Message ID <20130221161154.16162.55036.stgit@bling.home>
Download mbox | patch
Permalink /patch/222333/
State New
Headers show

Comments

Alex Williamson - Feb. 21, 2013, 4:12 p.m.
This should never get called, but if we somehow get a new chipset
that fails to implement their own pci_slot_get_irq function, fail
gracefully and add a debug log message.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 src/pciinit.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Kevin O'Connor - Feb. 22, 2013, 12:33 a.m.
On Thu, Feb 21, 2013 at 09:12:23AM -0700, Alex Williamson wrote:
> This should never get called, but if we somehow get a new chipset
> that fails to implement their own pci_slot_get_irq function, fail
> gracefully and add a debug log message.

Thanks.  I pushed this and the second part of your previous patch
series.

-Kevin

Patch

diff --git a/src/pciinit.c b/src/pciinit.c
index 70e4c07..a495742 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -91,7 +91,15 @@  const u8 pci_irqs[4] = {
     10, 10, 11, 11
 };
 
-static int (*pci_slot_get_irq)(struct pci_device *pci, int pin);
+static int dummy_pci_slot_get_irq(struct pci_device *pci, int pin)
+{
+    dprintf(1, "pci_slot_get_irq called with unknown routing\n");
+
+    return 0xff; /* PCI defined "unknown" or "no connection" for x86 */
+}
+
+static int (*pci_slot_get_irq)(struct pci_device *pci, int pin) =
+    dummy_pci_slot_get_irq;
 
 // Return the global irq number corresponding to a host bus device irq pin.
 static int piix_pci_slot_get_irq(struct pci_device *pci, int pin)