[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 10/32] spapr_pci: Rework device-tree rendering
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PATCH 10/32] spapr_pci: Rework device-tree rendering |
Date: |
Fri, 1 May 2015 16:41:28 +1000 |
From: Alexey Kardashevskiy <address@hidden>
This replaces object_child_foreach() and callback with existing
SPAPR_PCI_LIOBN() and spapr_tce_find_by_liobn() to make the code easier
to read.
This is a mechanical patch so no behaviour change is expected.
Signed-off-by: Alexey Kardashevskiy <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_pci.c | 30 +++++-------------------------
1 file changed, 5 insertions(+), 25 deletions(-)
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 79b6d3d..52c5c73 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1090,29 +1090,6 @@ PCIHostState *spapr_create_phb(sPAPREnvironment *spapr,
int index)
#define b_fff(x) b_x((x), 8, 3) /* function number */
#define b_rrrrrrrr(x) b_x((x), 0, 8) /* register number */
-typedef struct sPAPRTCEDT {
- void *fdt;
- int node_off;
-} sPAPRTCEDT;
-
-static int spapr_phb_children_dt(Object *child, void *opaque)
-{
- sPAPRTCEDT *p = opaque;
- sPAPRTCETable *tcet;
-
- tcet = (sPAPRTCETable *) object_dynamic_cast(child, TYPE_SPAPR_TCE_TABLE);
- if (!tcet || SPAPR_PCI_DMA_WINDOW_NUM(tcet->liobn)) {
- return 0;
- }
-
- spapr_dma_dt(p->fdt, p->node_off, "ibm,dma-window",
- tcet->liobn, tcet->bus_offset,
- tcet->nb_table << tcet->page_shift);
- /* Stop after the first window */
-
- return 1;
-}
-
int spapr_populate_pci_dt(sPAPRPHBState *phb,
uint32_t xics_phandle,
void *fdt)
@@ -1151,6 +1128,7 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
uint32_t interrupt_map_mask[] = {
cpu_to_be32(b_ddddd(-1)|b_fff(0)), 0x0, 0x0, cpu_to_be32(-1)};
uint32_t interrupt_map[PCI_SLOT_MAX * PCI_NUM_PINS][7];
+ sPAPRTCETable *tcet;
/* Start populating the FDT */
sprintf(nodename, "address@hidden" PRIx64, phb->buid);
@@ -1203,8 +1181,10 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
_FDT(fdt_setprop(fdt, bus_off, "interrupt-map", &interrupt_map,
sizeof(interrupt_map)));
- object_child_foreach(OBJECT(phb), spapr_phb_children_dt,
- &((sPAPRTCEDT){ .fdt = fdt, .node_off = bus_off }));
+ tcet = spapr_tce_find_by_liobn(SPAPR_PCI_LIOBN(phb->index, 0));
+ spapr_dma_dt(fdt, bus_off, "ibm,dma-window",
+ tcet->liobn, tcet->bus_offset,
+ tcet->nb_table << tcet->page_shift);
return 0;
}
--
2.1.0
- [Qemu-ppc] [PATCH 03/32] spapr_iommu: Make H_PUT_TCE_INDIRECT endian-safe, (continued)
- [Qemu-ppc] [PATCH 03/32] spapr_iommu: Make H_PUT_TCE_INDIRECT endian-safe, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 04/32] spapr_pci: Introduce a liobn number generating macros, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 05/32] spapr_vio: Introduce a liobn number generating macros, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 27/32] spapr_pci: create DRConnectors for each PCI slot during PHB realize, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 19/32] spapr_rtas: add set-indicator RTAS interface, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 02/32] spapr_iommu: Disable in-kernel IOMMU tables for >4GB windows, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 13/32] pseries: Add pseries-2.4 machine type, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 30/32] spapr_pci: emit hotplug add/remove events during hotplug, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 28/32] pci: make pci_bar useable outside pci.c, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 15/32] hw/ppc/spapr: Use error_report() instead of hw_error(), David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 10/32] spapr_pci: Rework device-tree rendering,
David Gibson <=
- [Qemu-ppc] [PATCH 06/32] spapr_pci: Define default DMA window size as a macro, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 32/32] spapr: override default ram size to 512MB, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 07/32] spapr_iommu: Add separate trace points for PCI DMA operations, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 24/32] spapr_events: event-scan RTAS interface, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 01/32] spapr_pci: Fix unsafe signed/unsigned comparisons, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 25/32] spapr_drc: add spapr_drc_populate_dt(), David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 08/32] spapr_pci: Make find_phb()/find_dev() public, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 31/32] machine: add default_ram_size to machine class, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 29/32] spapr_pci: enable basic hotplug operations, David Gibson, 2015/05/01
- [Qemu-ppc] [PATCH 22/32] spapr_rtas: add ibm, configure-connector RTAS interface, David Gibson, 2015/05/01