[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 10/13] ppc/pnv: Add a "pnor" const link property to the BMC in
From: |
Cédric Le Goater |
Subject: |
[PATCH v2 10/13] ppc/pnv: Add a "pnor" const link property to the BMC internal simulator |
Date: |
Thu, 19 Dec 2019 19:11:52 +0100 |
From: Greg Kurz <address@hidden>
This allows to get rid of a call to qdev_get_machine().
Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: Cédric Le Goater <address@hidden>
---
include/hw/ppc/pnv.h | 2 +-
hw/ppc/pnv.c | 2 +-
hw/ppc/pnv_bmc.c | 8 +++++---
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h
index 4c13d4394a11..d016ab0d0319 100644
--- a/include/hw/ppc/pnv.h
+++ b/include/hw/ppc/pnv.h
@@ -231,7 +231,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
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index e638cdc93091..34549aefa2fc 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -815,7 +815,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);
diff --git a/hw/ppc/pnv_bmc.c b/hw/ppc/pnv_bmc.c
index 07fa1e1c7e45..8863354c1c08 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 */
--
2.21.0
- [PATCH v2 05/13] spapr/xive: Use device_class_set_parent_realize(), (continued)
- [PATCH v2 05/13] spapr/xive: Use device_class_set_parent_realize(), Cédric Le Goater, 2019/12/19
- [PATCH v2 06/13] pnv/xive: Use device_class_set_parent_realize(), Cédric Le Goater, 2019/12/19
- [PATCH v2 07/13] spapr, pnv, xive: Add a "xive-fabric" link to the XIVE router, Cédric Le Goater, 2019/12/19
- [PATCH v2 08/13] xive: Use the XIVE fabric link under the XIVE router, Cédric Le Goater, 2019/12/19
- [PATCH v2 09/13] ppc/pnv: Add an "nr-threads" property to the base chip class, Cédric Le Goater, 2019/12/19
- [PATCH v2 10/13] ppc/pnv: Add a "pnor" const link property to the BMC internal simulator,
Cédric Le Goater <=
- [PATCH v2 11/13] xive: Add a "presenter" link property to the TCTX object, Cédric Le Goater, 2019/12/19
- [PATCH v2 12/13] spapr/xive: Deduce the SpaprXive pointer from XiveTCTX::xptr, Cédric Le Goater, 2019/12/19
- [PATCH v2 13/13] pnv/xive: Deduce the PnvXive pointer from XiveTCTX::xptr, Cédric Le Goater, 2019/12/19
- Re: [PATCH v2 00/13] ppc/pnv: remove the use of qdev_get_machine() and get_system_memory(), David Gibson, 2019/12/23