Skip to contentSkip to conversation

ppc/pegasos2: Fix reg property of 64 bit BARs in device tree

PATCH In review BALATON Zoltan 2 participants 3 messages Jul 21, 2023 – Jul 23, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc/pegasos2: Fix reg property of 64 bit BARs in device tree

The board firmware handles this correctly following the Open Firmware standard which we missed. This fixes 64 bit BARs when using VOF.

---
 hw/ppc/pegasos2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/ppc/pegasos2.c +5 -1
index 6475acfbed..075367d94d 100644
@@ -781,7 +781,11 @@ static void add_pci_device(PCIBus *bus, PCIDevice *d, void *opaque)
         if (d->io_regions[i].type & PCI_BASE_ADDRESS_SPACE_IO) {
             cells[j] |= cpu_to_be32(1 << 24);
         } else {
-            cells[j] |= cpu_to_be32(2 << 24);
+            if (d->io_regions[i].type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
+                cells[j] |= cpu_to_be32(3 << 24);
+            } else {
+                cells[j] |= cpu_to_be32(2 << 24);
+            }
             if (d->io_regions[i].type & PCI_BASE_ADDRESS_MEM_PREFETCH) {
                 cells[j] |= cpu_to_be32(4 << 28);
             }
Signature · 1 line
2.30.9
#1 lore raw
Quoted 2 lines · BALATON Zoltan

The board firmware handles this correctly following the Open Firmware standard which we missed. This fixes 64 bit BARs when using VOF.

In case it helps review this is defined in page 5 of this document:
https://www.openbios.org/data/docs/bus.pci.pdf

Quoted 23 lines

---
hw/ppc/pegasos2.c | 6 +++++-

1 file changed, 5 insertions(+), 1 deletion(-)
hw/ppc/pegasos2.c +5 -1
index 6475acfbed..075367d94d 100644
@@ -781,7 +781,11 @@ static void add_pci_device(PCIBus *bus, PCIDevice *d, void *opaque)
        if (d->io_regions[i].type & PCI_BASE_ADDRESS_SPACE_IO) {
            cells[j] |= cpu_to_be32(1 << 24);
        } else {
-            cells[j] |= cpu_to_be32(2 << 24);
+            if (d->io_regions[i].type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
+                cells[j] |= cpu_to_be32(3 << 24);
+            } else {
+                cells[j] |= cpu_to_be32(2 << 24);
+            }
            if (d->io_regions[i].type & PCI_BASE_ADDRESS_MEM_PREFETCH) {
                cells[j] |= cpu_to_be32(4 << 28);
            }
Reviewed-by on v1 1/1
#2 lore raw
In reply to BALATON Zoltan
Quoted 5 lines · BALATON Zoltan

The board firmware handles this correctly following the Open Firmware standard which we missed. This fixes 64 bit BARs when using VOF.

---

And queued. Thanks,

Daniel

Quoted 20 lines
  hw/ppc/pegasos2.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
hw/ppc/pegasos2.c +5 -1
index 6475acfbed..075367d94d 100644
@@ -781,7 +781,11 @@ static void add_pci_device(PCIBus *bus, PCIDevice *d, void *opaque)
          if (d->io_regions[i].type & PCI_BASE_ADDRESS_SPACE_IO) {
              cells[j] |= cpu_to_be32(1 << 24);
          } else {
-            cells[j] |= cpu_to_be32(2 << 24);
+            if (d->io_regions[i].type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
+                cells[j] |= cpu_to_be32(3 << 24);
+            } else {
+                cells[j] |= cpu_to_be32(2 << 24);
+            }
              if (d->io_regions[i].type & PCI_BASE_ADDRESS_MEM_PREFETCH) {
                  cells[j] |= cpu_to_be32(4 << 28);
              }