int sock_send_wakeup(int purpose) { if (accept_if_needed(purpose) != -1) return send_wakeup(purpose_table[purpose]); return -1; }
void domain_wake_from_s3(struct domain *d) { unsigned long s_state = 0; int handle; if (!d) return; if (!d->is_in_s3) return; if (host_pmop_in_progress()) { info("NOT resuming domain %d from S3 - host power operation in progress"); return; } info("Resuming domain %d from S3", d->domid); if (xc_handle != NULL) { xc_get_hvm_param(xc_handle, d->domid, HVM_PARAM_ACPI_S_STATE, &s_state); if (s_state == 3) xc_set_hvm_param(xc_handle, d->domid, HVM_PARAM_ACPI_S_STATE, 0); d->is_in_s3 = 0; d->sstate = 5; send_wakeup(d); } else { error("Failed to open xen control interface"); } // Waking up a PVM from S3 will trigger the PVM guest driver to re-initialize // the graphic device. Therefore, we might as well switch directly to it since // it is displayable until we find a way to recover the device once put in S3. if (d->is_pvm) { switcher_switch(d, 0, 0); } }