From 3770dcb825a1b3ae45edd92b3ac7642125294482 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Thu, 25 Apr 2013 10:23:07 +0000 Subject: [PATCH] --- yaml --- r: 374261 b: refs/heads/master c: 6abb749e83cf100bc4c71537e4c4e97ccdadcafe h: refs/heads/master i: 374259: 299c6d8171c2d2d1b34358b25df601640a951ac9 v: v3 --- [refs] | 2 +- trunk/arch/arm/xen/enlighten.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index dc80347a03d9..67115d946447 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d37a6e1687303ea0fcea89980373e3017b449963 +refs/heads/master: 6abb749e83cf100bc4c71537e4c4e97ccdadcafe diff --git a/trunk/arch/arm/xen/enlighten.c b/trunk/arch/arm/xen/enlighten.c index 6c87d116df63..9a0a917cdeb6 100644 --- a/trunk/arch/arm/xen/enlighten.c +++ b/trunk/arch/arm/xen/enlighten.c @@ -10,9 +10,12 @@ #include #include #include +#include +#include #include #include #include +#include #include #include #include @@ -173,6 +176,24 @@ static int __init xen_secondary_init(unsigned int cpu) return 0; } +static void xen_restart(char str, const char *cmd) +{ + struct sched_shutdown r = { .reason = SHUTDOWN_reboot }; + int rc; + rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r); + if (rc) + BUG(); +} + +static void xen_power_off(void) +{ + struct sched_shutdown r = { .reason = SHUTDOWN_poweroff }; + int rc; + rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r); + if (rc) + BUG(); +} + /* * see Documentation/devicetree/bindings/arm/xen.txt for the * documentation of the Xen Device Tree format. @@ -252,6 +273,9 @@ static int __init xen_guest_init(void) if (!xen_initial_domain()) xenbus_probe(NULL); + pm_power_off = xen_power_off; + arm_pm_restart = xen_restart; + return 0; } core_initcall(xen_guest_init);