Message ID | 1491396106-26376-12-git-send-email-clg@kaod.org |
---|---|
State | New |
Headers | show |
On Wed, Apr 05, 2017 at 02:41:36PM +0200, Cédric Le Goater wrote: > 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 <clg@kaod.org> This is so simple, I'd probably fold it into the next patch. But apart from that. Reviewed-by: David Gibson <david@gibson.dropbear.id.au> > --- > hw/ppc/pnv.c | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c > index 493c7eed7980..a3c8f6594d10 100644 > --- a/hw/ppc/pnv.c > +++ b/hw/ppc/pnv.c > @@ -281,6 +281,36 @@ 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; > + > + lpc_offset = fdt_node_offset_by_compatible(fdt, -1, "ibm,lpc"); > + if (lpc_offset < 0) { > + error_report("Could find the lpc node !?"); > + return; > + } > + > + args.fdt = fdt; > + args.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"; > @@ -328,6 +358,8 @@ static void *powernv_create_fdt(MachineState *machine) > for (i = 0; i < pnv->num_chips; i++) { > powernv_populate_chip(pnv->chips[i], fdt); > } > + > + powernv_populate_isa(pnv->isa_bus, fdt); > return fdt; > } >
On 04/10/2017 07:17 AM, David Gibson wrote: > On Wed, Apr 05, 2017 at 02:41:36PM +0200, Cédric Le Goater wrote: >> 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 <clg@kaod.org> > > This is so simple, I'd probably fold it into the next patch. But > apart from that. yes. I agree. The goal was to find an alternative to qbus_walk_children() which is not a QOM API. C. > Reviewed-by: David Gibson <david@gibson.dropbear.id.au> > >> --- >> hw/ppc/pnv.c | 32 ++++++++++++++++++++++++++++++++ >> 1 file changed, 32 insertions(+) >> >> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c >> index 493c7eed7980..a3c8f6594d10 100644 >> --- a/hw/ppc/pnv.c >> +++ b/hw/ppc/pnv.c >> @@ -281,6 +281,36 @@ 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; >> + >> + lpc_offset = fdt_node_offset_by_compatible(fdt, -1, "ibm,lpc"); >> + if (lpc_offset < 0) { >> + error_report("Could find the lpc node !?"); >> + return; >> + } >> + >> + args.fdt = fdt; >> + args.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"; >> @@ -328,6 +358,8 @@ static void *powernv_create_fdt(MachineState *machine) >> for (i = 0; i < pnv->num_chips; i++) { >> powernv_populate_chip(pnv->chips[i], fdt); >> } >> + >> + powernv_populate_isa(pnv->isa_bus, fdt); >> return fdt; >> } >> >
On Wed, 5 Apr 2017 14:41:36 +0200 Cédric Le Goater <clg@kaod.org> wrote: > 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 <clg@kaod.org> > --- > hw/ppc/pnv.c | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c > index 493c7eed7980..a3c8f6594d10 100644 > --- a/hw/ppc/pnv.c > +++ b/hw/ppc/pnv.c > @@ -281,6 +281,36 @@ 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; > + > + lpc_offset = fdt_node_offset_by_compatible(fdt, -1, "ibm,lpc"); > + if (lpc_offset < 0) { > + error_report("Could find the lpc node !?"); s/Could find/Could not find ? > + return; > + } > + > + args.fdt = fdt; > + args.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"; > @@ -328,6 +358,8 @@ static void *powernv_create_fdt(MachineState *machine) > for (i = 0; i < pnv->num_chips; i++) { > powernv_populate_chip(pnv->chips[i], fdt); > } > + > + powernv_populate_isa(pnv->isa_bus, fdt); > return fdt; > } >
On 04/10/2017 03:16 PM, Greg Kurz wrote: > On Wed, 5 Apr 2017 14:41:36 +0200 > Cédric Le Goater <clg@kaod.org> wrote: > >> 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 <clg@kaod.org> >> --- >> hw/ppc/pnv.c | 32 ++++++++++++++++++++++++++++++++ >> 1 file changed, 32 insertions(+) >> >> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c >> index 493c7eed7980..a3c8f6594d10 100644 >> --- a/hw/ppc/pnv.c >> +++ b/hw/ppc/pnv.c >> @@ -281,6 +281,36 @@ 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; >> + >> + lpc_offset = fdt_node_offset_by_compatible(fdt, -1, "ibm,lpc"); >> + if (lpc_offset < 0) { >> + error_report("Could find the lpc node !?"); > > s/Could find/Could not find ? yes. I will fix that. Thanks, C. > >> + return; >> + } >> + >> + args.fdt = fdt; >> + args.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"; >> @@ -328,6 +358,8 @@ static void *powernv_create_fdt(MachineState *machine) >> for (i = 0; i < pnv->num_chips; i++) { >> powernv_populate_chip(pnv->chips[i], fdt); >> } >> + >> + powernv_populate_isa(pnv->isa_bus, fdt); >> return fdt; >> } >> >
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 493c7eed7980..a3c8f6594d10 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -281,6 +281,36 @@ 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; + + lpc_offset = fdt_node_offset_by_compatible(fdt, -1, "ibm,lpc"); + if (lpc_offset < 0) { + error_report("Could find the lpc node !?"); + return; + } + + args.fdt = fdt; + args.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"; @@ -328,6 +358,8 @@ static void *powernv_create_fdt(MachineState *machine) for (i = 0; i < pnv->num_chips; i++) { powernv_populate_chip(pnv->chips[i], fdt); } + + powernv_populate_isa(pnv->isa_bus, fdt); return fdt; }
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 <clg@kaod.org> --- hw/ppc/pnv.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)