21 #include <linux/stat.h>
24 #include <asm/machdep.h>
27 #include <asm/topology.h>
30 static struct device suspend_dev;
32 static struct rtas_suspend_me_data suspend_data;
46 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
49 rc = plpar_hcall(H_VASI_STATE, retbuf, stream_id);
51 vasi_state = retbuf[0];
54 pr_err(
"pseries_suspend_begin: vasi_state returned %ld\n",rc);
56 }
else if (vasi_state == H_VASI_ENABLED) {
58 }
else if (vasi_state != H_VASI_SUSPENDING) {
59 pr_err(
"pseries_suspend_begin: vasi_state returned state %ld\n",
73 static int pseries_suspend_cpu(
void)
76 return rtas_suspend_cpu(&suspend_data);
88 int rc = rtas_suspend_last_cpu(&suspend_data);
101 static int pseries_prepare_late(
void)
107 suspend_data.complete = &suspend_work;
143 stop_topology_update();
145 start_topology_update();
157 static struct bus_type suspend_subsys = {
164 .begin = pseries_suspend_begin,
165 .prepare_late = pseries_prepare_late,
166 .enter = pseries_suspend_enter,
175 static int pseries_suspend_sysfs_register(
struct device *dev)
183 dev->
bus = &suspend_subsys;
186 goto subsys_unregister;
201 static int __init pseries_suspend_init(
void)
205 if (!machine_is(pseries) || !firmware_has_feature(FW_FEATURE_LPAR))
208 suspend_data.token =
rtas_token(
"ibm,suspend-me");
209 if (suspend_data.token == RTAS_UNKNOWN_SERVICE)
212 if ((rc = pseries_suspend_sysfs_register(&suspend_dev)))
215 ppc_md.suspend_disable_cpu = pseries_suspend_cpu;