Index: sys/dev/xen/control/control.c =================================================================== --- sys/dev/xen/control/control.c +++ sys/dev/xen/control/control.c @@ -394,6 +394,21 @@ } /*------------------ Private Device Attachment Functions --------------------*/ + +static void +notify_support(void) +{ + + /* + * Notify kernel is ready to handle "control/shutdown" events. Ignore + * errors if the nodes haven't been created by the toolstack, as the + * parent "control" directory should be read-only for the guest. + */ + xs_write(XST_NIL, "control", "feature-poweroff", "1"); + xs_write(XST_NIL, "control", "feature-reboot", "1"); + xs_write(XST_NIL, "control", "feature-suspend", "1"); +} + /** * \brief Identify instances of this device type in the system. * @@ -455,6 +470,8 @@ EVENTHANDLER_REGISTER(shutdown_final, xctrl_shutdown_final, NULL, SHUTDOWN_PRI_LAST); + notify_support(); + return (0); } @@ -479,6 +496,16 @@ return (0); } +static int +xctrl_resume(device_t dev) +{ + + notify_support(); + + return (0); +} + + /*-------------------- Private Device Attachment Data -----------------------*/ static device_method_t xctrl_methods[] = { /* Device interface */ @@ -486,6 +513,7 @@ DEVMETHOD(device_probe, xctrl_probe), DEVMETHOD(device_attach, xctrl_attach), DEVMETHOD(device_detach, xctrl_detach), + DEVMETHOD(device_resume, xctrl_resume), DEVMETHOD_END };