Brian King wrote:
Enables support for HMC initiated partition hibernation. This is
a firmware assisted hibernation, since the firmware handles writing
the memory out to disk, along with other partition information,
so we just mimic suspend to ram.
Signed-off-by: Brian King <[email protected]>
---
arch/powerpc/Kconfig | 2
arch/powerpc/include/asm/hvcall.h | 1
arch/powerpc/include/asm/machdep.h | 1
arch/powerpc/include/asm/rtas.h | 10 +
arch/powerpc/kernel/rtas.c | 118 ++++++++++-----
arch/powerpc/platforms/pseries/Makefile | 1
arch/powerpc/platforms/pseries/hotplug-cpu.c | 6
arch/powerpc/platforms/pseries/suspend.c | 209 +++++++++++++++++++++++++++
8 files changed, 312 insertions(+), 36 deletions(-)
diff -puN /dev/null arch/powerpc/platforms/pseries/suspend.c
--- /dev/null 2009-12-15 17:58:07.000000000 -0600
+++ linux-2.6-bjking1/arch/powerpc/platforms/pseries/suspend.c 2010-02-23
16:29:25.000000000 -0600
@@ -0,0 +1,209 @@
-- snip --
+
+static SYSDEV_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
+
+static struct sysdev_class suspend_sysdev_class = {
+ .name = "power",
+};
+
+static struct platform_suspend_ops pseries_suspend_ops = {
+ .valid = suspend_valid_only_mem,
+ .begin = pseries_suspend_begin,
+ .prepare_late = pseries_prepare_late,
+ .enter = pseries_suspend_enter,
+};
+
+/**
+ * pseries_suspend_sysfs_register - Register with sysfs
+ *
+ * Return value:
+ * 0 on success / other on failure
+ **/
+static int pseries_suspend_sysfs_register(struct sys_device *sysdev)
+{
+ int rc;
+
+ if ((rc = sysdev_class_register(&suspend_sysdev_class)))
+ return rc;
+
+ sysdev->id = 0;
+ sysdev->cls = &suspend_sysdev_class;
+
+ if ((rc = sysdev_register(sysdev)))
+ goto class_unregister;
+ if ((rc = sysdev_create_file(sysdev, &attr_hibernate)))
+ goto fail;
+
Could you just do a sysdev_class_create_file(&suspend_sysdev_class,
&attr_hibernate)
call to create the hibernate file instead of the sysdev_register() and
sysdev_create_file()? I think this may make it a bit nicer since the file
created
will be /sys/devices/system/power/hibernate instead of
/sys/devices/system/power/power0/hibernate.
-Nathan
+ return 0;
+
+fail:
+ sysdev_unregister(sysdev);
+class_unregister:
+ sysdev_class_unregister(&suspend_sysdev_class);
+ return rc;
+}
+
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev