[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 3/8] ppc/pnv: scan ISA bus to populate device tre
From: |
Cédric Le Goater |
Subject: |
[Qemu-devel] [PATCH v3 3/8] ppc/pnv: scan ISA bus to populate device tree |
Date: |
Tue, 11 Apr 2017 17:30:01 +0200 |
This is an empty shell that we will use to include nodes in the device
tree for ISA devices. We expect RTC, UART and IPMI BT devices.
Signed-off-by: Cédric Le Goater <address@hidden>
Reviewed-by: David Gibson <address@hidden>
---
Changes since v2:
- used the pnv_chip_lpc_offset() routine to locate the lpc node of
chip 0 in the device tree. This is more precise than looking for a
"ibm,lpc" compatible property.
hw/ppc/pnv.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 9468e991bfb2..c445906358d7 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -303,6 +303,29 @@ static void powernv_populate_chip(PnvChip *chip, void *fdt)
g_free(typename);
}
+typedef struct ForeachPopulateArgs {
+ void *fdt;
+ int offset;
+} ForeachPopulateArgs;
+
+static int powernv_populate_isa_device(DeviceState *dev, void *opaque)
+{
+ return 0;
+}
+
+static void powernv_populate_isa(ISABus *bus, void *fdt, int lpc_offset)
+{
+ ForeachPopulateArgs args = {
+ .fdt = fdt,
+ .offset = lpc_offset,
+ };
+
+ /* ISA devices are not necessarily parented to the ISA bus so we
+ * can not use object_child_foreach() */
+ qbus_walk_children(BUS(bus), powernv_populate_isa_device,
+ NULL, NULL, NULL, &args);
+}
+
static void *powernv_create_fdt(MachineState *machine)
{
const char plat_compat[] = "qemu,powernv\0ibm,powernv";
@@ -311,6 +334,7 @@ static void *powernv_create_fdt(MachineState *machine)
char *buf;
int off;
int i;
+ int lpc_offset;
fdt = g_malloc0(FDT_MAX_SIZE);
_FDT((fdt_create_empty_tree(fdt, FDT_MAX_SIZE)));
@@ -350,6 +374,10 @@ static void *powernv_create_fdt(MachineState *machine)
for (i = 0; i < pnv->num_chips; i++) {
powernv_populate_chip(pnv->chips[i], fdt);
}
+
+ /* Populate ISA devices on chip 0 */
+ lpc_offset = pnv_chip_lpc_offset(pnv->chips[0], fdt);
+ powernv_populate_isa(pnv->isa_bus, fdt, lpc_offset);
return fdt;
}
--
2.7.4
- [Qemu-devel] [PATCH v3 0/8] pnv: improvement of LPC support and IPMI support, Cédric Le Goater, 2017/04/11
- [Qemu-devel] [PATCH v3 1/8] ppc/pnv: Add support for POWER8+ LPC Controller, Cédric Le Goater, 2017/04/11
- [Qemu-devel] [PATCH v3 2/8] ppc/pnv: enable only one LPC bus, Cédric Le Goater, 2017/04/11
- [Qemu-devel] [PATCH v3 3/8] ppc/pnv: scan ISA bus to populate device tree,
Cédric Le Goater <=
- [Qemu-devel] [PATCH v3 4/8] ppc/pnv: populate device tree for RTC devices, Cédric Le Goater, 2017/04/11
- [Qemu-devel] [PATCH v3 5/8] ppc/pnv: populate device tree for serial devices, Cédric Le Goater, 2017/04/11
- [Qemu-devel] [PATCH v3 6/8] ppc/pnv: populate device tree for IPMI BT devices, Cédric Le Goater, 2017/04/11
- [Qemu-devel] [PATCH v3 8/8] ppc/pnv: generate an OEM SEL event on shutdown, Cédric Le Goater, 2017/04/11
- [Qemu-devel] [PATCH v3 7/8] ppc/pnv: add initial IPMI sensors for the BMC simulator, Cédric Le Goater, 2017/04/11
- Re: [Qemu-devel] [PATCH v3 0/8] pnv: improvement of LPC support and IPMI support, David Gibson, 2017/04/12