748
749
static void pnv_reset(MachineState *machine, ResetType type)
750
{
751
- PnvMachineState *pnv = PNV_MACHINE(machine);
752
- IPMIBmc *bmc;
751
void *fdt;
752
753
qemu_devices_reset(type);
754
757
- /*
758
- * The machine should provide by default an internal BMC simulator.
759
- * If not, try to use the BMC device that was provided on the command
760
- * line.
761
- */
762
- bmc = pnv_bmc_find(&error_fatal);
763
- if (!pnv->bmc) {
764
- if (!bmc) {
765
- if (!qtest_enabled()) {
766
- warn_report("machine has no BMC device. Use '-device "
767
- "ipmi-bmc-sim,id=bmc0 -device isa-ipmi-bt,bmc=bmc0,irq=10' "
768
- "to define one");
769
- }
770
- } else {
771
- pnv_bmc_set_pnor(bmc, pnv->pnor);
772
- pnv->bmc = bmc;
773
- }
774
- }
775
-
755
fdt = machine->fdt;
756
cpu_physical_memory_write(PNV_FDT_ADDR, fdt, fdt_totalsize(fdt));
757
}
963
return chip_id == 0 ? 1 * GiB : QEMU_ALIGN_DOWN(ram_per_chip, 1 * MiB);
964
}
965
966
+static void pnv_machine_init_done(Notifier *notifier, void *data)
967
+{
968
+ PnvMachineState *pnv = container_of(notifier, PnvMachineState, machine_init_done);
969
+ MachineState *machine = MACHINE(pnv);
970
+ IPMIBmc *bmc;
971
+
972
+ /*
973
+ * The machine should provide by default an internal BMC simulator.
974
+ * If not, try to use the BMC device that was provided on the command
975
+ * line.
976
+ */
977
+ bmc = pnv_bmc_find(&error_fatal);
978
+ if (!pnv->bmc) {
979
+ if (!bmc) {
980
+ if (!qtest_enabled()) {
981
+ warn_report("machine has no BMC device. Use '-device "
982
+ "ipmi-bmc-sim,id=bmc0 -device isa-ipmi-bt,bmc=bmc0,irq=10' "
983
+ "to define one");
984
+ }
985
+ } else {
986
+ pnv_bmc_set_pnor(bmc, pnv->pnor);
987
+ pnv->bmc = bmc;
988
+ }
989
+ }
990
+
991
+ if (!machine->fdt) {
992
+ machine->fdt = pnv_dt_create(machine);
993
+ _FDT((fdt_pack(machine->fdt)));
994
+ }
995
+}
996
+
997
static void pnv_init(MachineState *machine)
998
{
999
const char *bios_name = machine->firmware ?: FW_FILE_NAME;
1254
pmc->i2c_init(pnv);
1255
}
1256
1247
- if (!machine->fdt) {
1248
- machine->fdt = pnv_dt_create(machine);
1249
- _FDT((fdt_pack(machine->fdt)));
1250
- }
1257
+ pnv->machine_init_done.notify = pnv_machine_init_done;
1258
+ qemu_add_machine_init_done_notifier(&pnv->machine_init_done);
1259
}
1260
1261
/*