diff options
author | Greg Kurz | 2020-01-06 15:56:40 +0100 |
---|---|---|
committer | David Gibson | 2020-01-08 01:01:59 +0100 |
commit | d8137bb7296e55c74b081b48f8cf31aad3b7632e (patch) | |
tree | 5d3a3b52a0d168944d07f8c51f0c10791306a2e3 /hw/ppc/pnv_bmc.c | |
parent | ppc/pnv: Add an "nr-threads" property to the base chip class (diff) | |
download | qemu-d8137bb7296e55c74b081b48f8cf31aad3b7632e.tar.gz qemu-d8137bb7296e55c74b081b48f8cf31aad3b7632e.tar.xz qemu-d8137bb7296e55c74b081b48f8cf31aad3b7632e.zip |
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: Greg Kurz <groug@kaod.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20200106145645.4539-8-clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/pnv_bmc.c')
-rw-r--r-- | hw/ppc/pnv_bmc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/hw/ppc/pnv_bmc.c b/hw/ppc/pnv_bmc.c index 07fa1e1c7e..8863354c1c 100644 --- a/hw/ppc/pnv_bmc.c +++ b/hw/ppc/pnv_bmc.c @@ -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 */ |