54
#include "hw/ppc/pnv_chip.h"
55
#include "hw/ppc/pnv_xscom.h"
56
#include "hw/ppc/pnv_pnor.h"
57
+#include "hw/ppc/pnv_mpipl.h"
58
59
#include "hw/isa/isa.h"
60
#include "hw/char/serial-isa.h"
673
_FDT(fdt_setprop_cell(fdt, off, "ibm,enabled-stop-levels", 0xc0000000));
674
}
675
676
+static void pnv_dt_mpipl_dump(PnvMachineState *pnv, void *fdt)
677
+{
678
+ int off;
679
+
680
+ /*
681
+ * Add "dump" node so kernel knows MPIPL (aka fadump) is supported
682
+ *
683
+ * Note: This is only needed to be done since we are passing device tree to
684
+ * opal
685
+ *
686
+ * In case HDAT is supported in future, then opal can add these nodes by
687
+ * itself based on system attribute having MPIPL_SUPPORTED bit set
688
+ */
689
+ off = fdt_add_subnode(fdt, 0, "ibm,opal");
690
+ if (off == -FDT_ERR_EXISTS) {
691
+ off = fdt_path_offset(fdt, "/ibm,opal");
692
+ }
693
+
694
+ _FDT(off);
695
+ off = fdt_add_subnode(fdt, off, "dump");
696
+ _FDT(off);
697
+ _FDT((fdt_setprop_string(fdt, off, "compatible", "ibm,opal-dump")));
698
+
699
+ /* Add kernel and initrd as fw-load-area */
700
+ uint64_t fw_load_area[4] = {
701
+ cpu_to_be64(KERNEL_LOAD_ADDR), cpu_to_be64(KERNEL_MAX_SIZE),
702
+ cpu_to_be64(INITRD_LOAD_ADDR), cpu_to_be64(INITRD_MAX_SIZE)
703
+ };
704
+
705
+ _FDT((fdt_setprop(fdt, off, "fw-load-area",
706
+ fw_load_area, sizeof(fw_load_area))));
707
+}
708
+
709
static void *pnv_dt_create(MachineState *machine)
710
{
711
PnvMachineClass *pmc = PNV_MACHINE_GET_CLASS(machine);
768
pmc->dt_power_mgt(pnv, fdt);
769
}
770
771
+ /* Advertise support for MPIPL */
772
+ pnv_dt_mpipl_dump(pnv, fdt);
773
+
774
return fdt;
775
}
776
802
mpipl_write_succeeded = do_mpipl_write(pnv);
803
}
804
805
+ /* Regenerate device tree */
806
+ fdt = pnv_dt_create(machine);
807
+ _FDT((fdt_pack(fdt)));
808
+
809
/*
810
* If it's a MPIPL boot, add the "mpipl-boot" property, and reset the
811
* boolean for MPIPL boot for next boot
855
sizeof(proc_area));
856
}
857
817
- fdt = machine->fdt;
858
cpu_physical_memory_write(PNV_FDT_ADDR, fdt, fdt_totalsize(fdt));
859
+
860
+ /* Free previous device tree set by pnv_init/reset/machine_init_done */
861
+ g_free(machine->fdt);
862
+ machine->fdt = fdt;
863
}
864
865
static ISABus *pnv_chip_power8_isa_create(PnvChip *chip, Error **errp)