Commit d8137bb7 authored by Greg Kurz's avatar Greg Kurz Committed by David Gibson
Browse files

ppc/pnv: Add a "pnor" const link property to the BMC internal simulator



This allows to get rid of a call to qdev_get_machine().

Signed-off-by: default avatarGreg Kurz <groug@kaod.org>
Signed-off-by: default avatarCédric Le Goater <clg@kaod.org>
Message-Id: <20200106145645.4539-8-clg@kaod.org>
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent 764f9b25
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -820,7 +820,7 @@ static void pnv_init(MachineState *machine)
    g_free(chip_typename);

    /* Create the machine BMC simulator */
    pnv->bmc = pnv_bmc_create();
    pnv->bmc = pnv_bmc_create(pnv->pnor);

    /* Instantiate ISA bus on chip 0 */
    pnv->isa_bus = pnv_isa_create(pnv->chips[0], &error_fatal);
+5 −3
Original line number Diff line number Diff line
@@ -143,8 +143,8 @@ static uint16_t bytes_to_blocks(uint32_t bytes)
static void hiomap_cmd(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len,
                       RspBuffer *rsp)
{
    PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
    PnvPnor *pnor = pnv->pnor;
    PnvPnor *pnor = PNV_PNOR(object_property_get_link(OBJECT(ibs), "pnor",
                                                      &error_abort));
    uint32_t pnor_size = pnor->size;
    uint32_t pnor_addr = PNOR_SPI_OFFSET;
    bool readonly = false;
@@ -217,11 +217,13 @@ static const IPMINetfn hiomap_netfn = {
 * Instantiate the machine BMC. PowerNV uses the QEMU internal
 * simulator but it could also be external.
 */
IPMIBmc *pnv_bmc_create(void)
IPMIBmc *pnv_bmc_create(PnvPnor *pnor)
{
    Object *obj;

    obj = object_new(TYPE_IPMI_BMC_SIMULATOR);
    object_ref(OBJECT(pnor));
    object_property_add_const_link(obj, "pnor", OBJECT(pnor), &error_abort);
    object_property_set_bool(obj, true, "realized", &error_fatal);

    /* Install the HIOMAP protocol handlers to access the PNOR */
+1 −1
Original line number Diff line number Diff line
@@ -229,7 +229,7 @@ PnvChip *pnv_get_chip(uint32_t chip_id);
 */
void pnv_dt_bmc_sensors(IPMIBmc *bmc, void *fdt);
void pnv_bmc_powerdown(IPMIBmc *bmc);
IPMIBmc *pnv_bmc_create(void);
IPMIBmc *pnv_bmc_create(PnvPnor *pnor);

/*
 * POWER8 MMIO base addresses