aboutsummaryrefslogtreecommitdiff
path: root/hw/pci-host
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-11-25 11:52:40 +0000
committerPeter Maydell <peter.maydell@linaro.org>2022-12-16 15:59:07 +0000
commita0c2e80afc98a9771b109eb5ce0b47edd7c78155 (patch)
tree23093f89b74b58726dfdc1033825ad5e0ad9b749 /hw/pci-host
parenta359da4c62a59d400c3081160b1105e2fd8e719e (diff)
hw/pci-host/pnv_phb3_msi: Convert TYPE_PHB3_MSI to 3-phase reset
Convert the TYPE_PHB3_MSI class to 3-phase reset, so we can avoid using the device_class_set_parent_reset() function. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20221125115240.3005559-8-peter.maydell@linaro.org
Diffstat (limited to 'hw/pci-host')
-rw-r--r--hw/pci-host/pnv_phb3_msi.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/hw/pci-host/pnv_phb3_msi.c b/hw/pci-host/pnv_phb3_msi.c
index ae908fd9e4..41e63b066f 100644
--- a/hw/pci-host/pnv_phb3_msi.c
+++ b/hw/pci-host/pnv_phb3_msi.c
@@ -228,12 +228,14 @@ static void phb3_msi_resend(ICSState *ics)
}
}
-static void phb3_msi_reset(DeviceState *dev)
+static void phb3_msi_reset_hold(Object *obj)
{
- Phb3MsiState *msi = PHB3_MSI(dev);
- ICSStateClass *icsc = ICS_GET_CLASS(dev);
+ Phb3MsiState *msi = PHB3_MSI(obj);
+ ICSStateClass *icsc = ICS_GET_CLASS(obj);
- icsc->parent_reset(dev);
+ if (icsc->parent_phases.hold) {
+ icsc->parent_phases.hold(obj);
+ }
memset(msi->rba, 0, sizeof(msi->rba));
msi->rba_sum = 0;
@@ -287,11 +289,12 @@ static void phb3_msi_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
ICSStateClass *isc = ICS_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
device_class_set_parent_realize(dc, phb3_msi_realize,
&isc->parent_realize);
- device_class_set_parent_reset(dc, phb3_msi_reset,
- &isc->parent_reset);
+ resettable_class_set_parent_phases(rc, NULL, phb3_msi_reset_hold, NULL,
+ &isc->parent_phases);
isc->reject = phb3_msi_reject;
isc->resend = phb3_msi_resend;