aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc/spapr_drc.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/ppc/spapr_drc.c')
-rw-r--r--hw/ppc/spapr_drc.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index 8a2b8f5f65..9a2511fb00 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -378,7 +378,6 @@ static bool release_pending(sPAPRDRConnector *drc)
static void reset(DeviceState *d)
{
sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(d);
- sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
trace_spapr_drc_reset(spapr_drc_index(drc));
@@ -386,27 +385,25 @@ static void reset(DeviceState *d)
drc->ccs = NULL;
/* immediately upon reset we can safely assume DRCs whose devices
- * are pending removal can be safely removed, and that they will
- * subsequently be left in an ISOLATED state. move the DRC to this
- * state in these cases (which will in turn complete any pending
- * device removals)
+ * are pending removal can be safely removed.
*/
if (drc->awaiting_release) {
- drck->set_isolation_state(drc, SPAPR_DR_ISOLATION_STATE_ISOLATED);
- /* generally this should also finalize the removal, but if the device
- * hasn't yet been configured we normally defer removal under the
- * assumption that this transition is taking place as part of device
- * configuration. so check if we're still waiting after this, and
- * force removal if we are
- */
- if (drc->awaiting_release) {
- spapr_drc_detach(drc, DEVICE(drc->dev), NULL);
- }
+ spapr_drc_release(drc);
+ }
+
+ drc->awaiting_allocation = false;
- /* non-PCI devices may be awaiting a transition to UNUSABLE */
- if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI &&
- drc->awaiting_release) {
- drck->set_allocation_state(drc, SPAPR_DR_ALLOCATION_STATE_UNUSABLE);
+ if (drc->dev) {
+ /* A device present at reset is coldplugged */
+ drc->isolation_state = SPAPR_DR_ISOLATION_STATE_UNISOLATED;
+ if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI) {
+ drc->allocation_state = SPAPR_DR_ALLOCATION_STATE_USABLE;
+ }
+ } else {
+ /* Otherwise device is absent, but might be hotplugged */
+ drc->isolation_state = SPAPR_DR_ISOLATION_STATE_ISOLATED;
+ if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI) {
+ drc->allocation_state = SPAPR_DR_ALLOCATION_STATE_UNUSABLE;
}
}
}