Skip to contentSkip to conversation

hw/ppc/spapr: Adjust firmware name for PCI bridges

PATCH Applied Thomas Huth 2 participants 2 messages Jun 7, 2017 – Jun 8, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/ppc/spapr: Adjust firmware name for PCI bridges

SLOF uses "pci" as name for PCI bridges nodes in the device tree instead of "pci-bridges", so booting via bootindex from a device behind a PCI bridge currently does not work since QEMU passes the wrong name in the "qemu,boot-list" property. Fix it by changing the name of the PCI bridge nodes to "pci" instead.

---
 hw/ppc/spapr.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/ppc/spapr.c +6 -0
index 91b4057..27b1f3c 100644
@@ -2441,6 +2441,12 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus,
         return g_strdup_printf("disk@%"PRIX64, (uint64_t)id << 32);
     }
 
+    if (g_str_equal("pci-bridge", qdev_fw_name(dev))) {
+        /* SLOF uses "pci" instead of "pci-bridge" for PCI bridges */
+        PCIDevice *pcidev = CAST(PCIDevice, dev, TYPE_PCI_DEVICE);
+        return g_strdup_printf("pci@%x", PCI_SLOT(pcidev->devfn));
+    }
+
     return NULL;
 }
 
Signature · 1 line
1.8.3.1
Applied
#1 lore raw
Quoted 8 lines · Thomas Huth

SLOF uses "pci" as name for PCI bridges nodes in the device tree instead of "pci-bridges", so booting via bootindex from a device behind a PCI bridge currently does not work since QEMU passes the wrong name in the "qemu,boot-list" property. Fix it by changing the name of the PCI bridge nodes to "pci" instead.

Applied to ppc-for-2.10.

Quoted 21 lines
---
 hw/ppc/spapr.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/ppc/spapr.c +6 -0
index 91b4057..27b1f3c 100644
@@ -2441,6 +2441,12 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus,
         return g_strdup_printf("disk@%"PRIX64, (uint64_t)id << 32);
     }
 
+    if (g_str_equal("pci-bridge", qdev_fw_name(dev))) {
+        /* SLOF uses "pci" instead of "pci-bridge" for PCI bridges */
+        PCIDevice *pcidev = CAST(PCIDevice, dev, TYPE_PCI_DEVICE);
+        return g_strdup_printf("pci@%x", PCI_SLOT(pcidev->devfn));
+    }
+
     return NULL;
 }
 
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson