These messages are helpful for comparing the assignments made by OVMF
against those made by SeaBIOS. To SeaBIOS a small debug patch like the
following can be applied:

> diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
> index ac39d23..9e61c22 100644
> --- a/src/fw/pciinit.c
> +++ b/src/fw/pciinit.c
> @@ -308,8 +308,12 @@ static void pci_bios_init_device(struct pci_device *pci)
>
>      /* map the interrupt */
>      int pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN);
> -    if (pin != 0)
> -        pci_config_writeb(bdf, PCI_INTERRUPT_LINE, pci_slot_get_irq(pci, 
> pin));
> +    if (pin != 0) {
> +        int irqline = pci_slot_get_irq(pci, pin);
> +
> +        pci_config_writeb(bdf, PCI_INTERRUPT_LINE, irqline);
> +        dprintf(1, "assigned irq line %d\n", irqline);
> +    }
>
>      pci_init_device(pci_device_tbl, pci, NULL);
>

Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Gabriel Somlo <so...@cmu.edu>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
Acked-by: Gabriel Somlo <so...@cmu.edu>
---

Notes:
    v2:
    - use PciIo.GetLocation() too, in order to get an output more easily 
comparable
      with SeaBIOS's
    - drop Gabriel's Regression-tested-by

 OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c 
b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
index 1eb2a8b..fdae6b1 100644
--- a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
@@ -749,6 +749,7 @@ SetPciIntLine (
   )
 {
   EFI_DEVICE_PATH_PROTOCOL  *DevPathNode;
+  EFI_DEVICE_PATH_PROTOCOL  *DevPath;
   UINTN                     RootSlot;
   UINTN                     Idx;
   UINT8                     IrqLine;
@@ -760,6 +761,7 @@ SetPciIntLine (
 
     DevPathNode = DevicePathFromHandle (Handle);
     ASSERT (DevPathNode != NULL);
+    DevPath = DevPathNode;
 
     //
     // Compute index into PciHostIrqs[] table by walking
@@ -832,6 +834,29 @@ SetPciIntLine (
     Idx %= ARRAY_SIZE (PciHostIrqs);
     IrqLine = PciHostIrqs[Idx];
 
+    DEBUG_CODE_BEGIN ();
+    {
+      CHAR16        *DevPathString;
+      STATIC CHAR16 Fallback[] = L"<failed to convert>";
+      UINTN         Segment, Bus, Device, Function;
+
+      DevPathString = ConvertDevicePathToText (DevPath, FALSE, FALSE);
+      if (DevPathString == NULL) {
+        DevPathString = Fallback;
+      }
+      Status = PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);
+      ASSERT_EFI_ERROR (Status);
+
+      DEBUG ((EFI_D_VERBOSE, "%a: [%02x:%02x.%x] %s -> 0x%02x\n", __FUNCTION__,
+        (UINT32)Bus, (UINT32)Device, (UINT32)Function, DevPathString,
+        IrqLine));
+
+      if (DevPathString != Fallback) {
+        FreePool (DevPathString);
+      }
+    }
+    DEBUG_CODE_END ();
+
     //
     // Set PCI Interrupt Line register for this device to PciHostIrqs[Idx]
     //
-- 
1.8.3.1



------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to