#include "hw/ppc/pnv_chip.h"
#include "hw/ppc/pnv_xscom.h"
#include "hw/ppc/pnv_pnor.h"
+#include "hw/ppc/pnv_mpipl.h"
#include "hw/isa/isa.h"
#include "hw/char/serial-isa.h"
_FDT(fdt_setprop_cell(fdt, off, "ibm,enabled-stop-levels", 0xc0000000));
}
+static void pnv_dt_mpipl_dump(PnvMachineState *pnv, void *fdt)
+{
+ int off;
+
+ /*
+ * Add "dump" node so kernel knows MPIPL (aka fadump) is supported
+ *
+ * Note: This is only needed to be done since we are passing device tree to
+ * opal
+ *
+ * In case HDAT is supported in future, then opal can add these nodes by
+ * itself based on system attribute having MPIPL_SUPPORTED bit set
+ */
+ off = fdt_add_subnode(fdt, 0, "ibm,opal");
+ if (off == -FDT_ERR_EXISTS) {
+ off = fdt_path_offset(fdt, "/ibm,opal");
+ }
+
+ _FDT(off);
+ off = fdt_add_subnode(fdt, off, "dump");
+ _FDT(off);
+ _FDT((fdt_setprop_string(fdt, off, "compatible", "ibm,opal-dump")));
+
+ /* Add kernel and initrd as fw-load-area */
+ uint64_t fw_load_area[4] = {
+ cpu_to_be64(KERNEL_LOAD_ADDR), cpu_to_be64(KERNEL_MAX_SIZE),
+ cpu_to_be64(INITRD_LOAD_ADDR), cpu_to_be64(INITRD_MAX_SIZE)
+ };
+
+ _FDT((fdt_setprop(fdt, off, "fw-load-area",
+ fw_load_area, sizeof(fw_load_area))));
+}
+
static void *pnv_dt_create(MachineState *machine)
{
PnvMachineClass *pmc = PNV_MACHINE_GET_CLASS(machine);
pmc->dt_power_mgt(pnv, fdt);
}
+ /* Advertise support for MPIPL */
+ pnv_dt_mpipl_dump(pnv, fdt);
+
return fdt;
}
mpipl_write_succeeded = do_mpipl_write(pnv);
}
+ /* Regenerate device tree */
+ fdt = pnv_dt_create(machine);
+ _FDT((fdt_pack(fdt)));
+
/*
* If it's a MPIPL boot, add the "mpipl-boot" property, and reset the
* boolean for MPIPL boot for next boot
sizeof(proc_area));
}
- fdt = machine->fdt;
cpu_physical_memory_write(PNV_FDT_ADDR, fdt, fdt_totalsize(fdt));
+
+ /* Free previous device tree set by pnv_init/reset/machine_init_done */
+ g_free(machine->fdt);
+ machine->fdt = fdt;
}
static ISABus *pnv_chip_power8_isa_create(PnvChip *chip, Error **errp)