]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: PlatformBdsLib: debug log interrupt line assignments
authorLaszlo Ersek <lersek@redhat.com>
Tue, 14 Jul 2015 12:01:43 +0000 (12:01 +0000)
committerlersek <lersek@Edk2>
Tue, 14 Jul 2015 12:01:43 +0000 (12:01 +0000)
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.justen@intel.com>
Cc: Gabriel Somlo <somlo@cmu.edu>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17952 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c

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