* [PATCH 25/30] loongson: Hibernation Support in mips system
@ 2009-05-15 22:28 Wu Zhangjin
2009-05-15 22:28 ` Wu Zhangjin
2009-05-24 19:41 ` Pavel Machek
0 siblings, 2 replies; 4+ messages in thread
From: Wu Zhangjin @ 2009-05-15 22:28 UTC (permalink / raw)
To: linux-mips, Ralf Baechle, linux-kernel
Cc: Arnaud Patard, loongson-dev, zhangfx, yanh, Philippe Vachon,
Zhang Le, Erwan Lerale
>From d4776f4891b9be96d357910f62d9ebaf898a3015 Mon Sep 17 00:00:00 2001
From: Wu Zhangjin <wuzhangjin@gmail.com>
Date: Sat, 16 May 2009 04:51:26 +0800
Subject: [PATCH 25/30] loongson: Hibernation Support in mips system
---
arch/mips/Kconfig | 3 +
arch/mips/Makefile | 3 +
arch/mips/include/asm/suspend.h | 2 +
arch/mips/kernel/asm-offsets.c | 13 ++++++
arch/mips/power/Makefile | 1 +
arch/mips/power/cpu.c | 48 ++++++++++++++++++++++++
arch/mips/power/hibernate.S | 78
+++++++++++++++++++++++++++++++++++++++
include/linux/suspend.h | 2 +-
8 files changed, 149 insertions(+), 1 deletions(-)
create mode 100644 arch/mips/power/Makefile
create mode 100644 arch/mips/power/cpu.c
create mode 100644 arch/mips/power/hibernate.S
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 68c12de..b14e866 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2130,6 +2130,9 @@ endmenu
menu "Power management options"
+config ARCH_HIBERNATION_POSSIBLE
+ def_bool y
+
config ARCH_SUSPEND_POSSIBLE
def_bool y
depends on !SMP
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index d73f084..8bde363 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -677,6 +677,9 @@ core-y += arch/mips/kernel/ arch/mips/mm/
arch/mips/math-emu/
drivers-$(CONFIG_OPROFILE) += arch/mips/oprofile/
+# suspend and hibernation support
+drivers-$(CONFIG_PM) += arch/mips/power/
+
ifdef CONFIG_LASAT
rom.bin rom.sw: vmlinux
$(Q)$(MAKE) $(build)=arch/mips/lasat/image $@
diff --git a/arch/mips/include/asm/suspend.h
b/arch/mips/include/asm/suspend.h
index 2562f8f..1d44287 100644
--- a/arch/mips/include/asm/suspend.h
+++ b/arch/mips/include/asm/suspend.h
@@ -3,4 +3,6 @@
/* Somewhen... Maybe :-) */
+static inline int arch_prepare_suspend(void) { return 0; }
+
#endif /* __ASM_SUSPEND_H */
diff --git a/arch/mips/kernel/asm-offsets.c
b/arch/mips/kernel/asm-offsets.c
index c901c22..94964f5 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -14,6 +14,7 @@
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/kbuild.h>
+#include <linux/suspend.h>
#include <asm/ptrace.h>
#include <asm/processor.h>
@@ -326,3 +327,15 @@ void output_octeon_cop2_state_defines(void)
BLANK();
}
#endif
+
+#ifdef CONFIG_HIBERNATION
+void output_pbe_defines(void)
+{
+ COMMENT(" Linux struct pbe offsets. ");
+ OFFSET(PBE_ADDRESS , pbe, address);
+ OFFSET(PBE_ORIG_ADDRESS , pbe, orig_address);
+ OFFSET(PBE_NEXT , pbe, next);
+ DEFINE(PBE_SIZE , sizeof(struct pbe));
+ BLANK();
+}
+#endif
diff --git a/arch/mips/power/Makefile b/arch/mips/power/Makefile
new file mode 100644
index 0000000..73d56b8
--- /dev/null
+++ b/arch/mips/power/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_HIBERNATION) += cpu.o hibernate.o
diff --git a/arch/mips/power/cpu.c b/arch/mips/power/cpu.c
new file mode 100644
index 0000000..b799bfe
--- /dev/null
+++ b/arch/mips/power/cpu.c
@@ -0,0 +1,48 @@
+/*
+ * Suspend support specific for mips.
+ *
+ */
+#include <linux/mm.h>
+#include <asm/mipsregs.h>
+#include <asm/page.h>
+#include <asm/suspend.h>
+
+/* References to section boundaries */
+extern const void __nosave_begin, __nosave_end;
+static uint32_t saved_status;
+unsigned long
+ saved_ra,
+ saved_sp,
+ saved_fp,
+ saved_gp,
+ saved_s0,
+ saved_s1,
+ saved_s2,
+ saved_s3,
+ saved_s4,
+ saved_s5,
+ saved_s6,
+ saved_s7,
+ saved_a0,
+ saved_a1,
+ saved_a2,
+ saved_a3,
+ saved_v0,
+ saved_v1;
+
+void save_processor_state(void)
+{
+ saved_status = read_c0_status();
+}
+
+void restore_processor_state(void)
+{
+ write_c0_status(saved_status);
+}
+
+int pfn_is_nosave(unsigned long pfn)
+{
+ unsigned long nosave_begin_pfn = __pa(&__nosave_begin) >> PAGE_SHIFT;
+ unsigned long nosave_end_pfn = PAGE_ALIGN(__pa(&__nosave_end)) >>
PAGE_SHIFT;
+ return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
+}
diff --git a/arch/mips/power/hibernate.S b/arch/mips/power/hibernate.S
new file mode 100644
index 0000000..e45ec45
--- /dev/null
+++ b/arch/mips/power/hibernate.S
@@ -0,0 +1,78 @@
+#incldue <linux/linkage.h>
+#include <asm/asm-offsets.h>
+#include <asm/regdef.h>
+#include <asm/asm.h>
+
+.text
+LEAF(swsusp_arch_suspend)
+ PTR_LA t0, saved_ra
+ PTR_S ra, (t0)
+ PTR_LA t0, saved_sp
+ PTR_S sp, (t0)
+ PTR_LA t0, saved_fp
+ PTR_S fp, (t0)
+ PTR_LA t0, saved_gp
+ PTR_S gp, (t0)
+ PTR_LA t0, saved_s0
+ PTR_S s0, (t0)
+ PTR_LA t0, saved_s1
+ PTR_S s1, (t0)
+ PTR_LA t0, saved_s2
+ PTR_S s2, (t0)
+ PTR_LA t0, saved_s3
+ PTR_S s3, (t0)
+ PTR_LA t0, saved_s4
+ PTR_S s4, (t0)
+ PTR_LA t0, saved_s5
+ PTR_S s5, (t0)
+ PTR_LA t0, saved_s6
+ PTR_S s6, (t0)
+ PTR_LA t0, saved_s7
+ PTR_S s7, (t0)
+ PTR_LA t0, saved_a0
+ PTR_S a0, (t0)
+ PTR_LA t0, saved_a1
+ PTR_S a1, (t0)
+ PTR_LA t0, saved_a2
+ PTR_S a2, (t0)
+ PTR_LA t0, saved_v1
+ PTR_S v1, (t0)
+ j swsusp_save
+ nop
+END(swsusp_arch_suspend)
+
+LEAF(swsusp_arch_resume)
+ PTR_L t0, restore_pblist
+0:
+ PTR_L t1, PBE_ADDRESS(t0) /* source */
+ PTR_L t2, PBE_ORIG_ADDRESS(t0) /* destination */
+ PTR_ADDIU t3, t1, _PAGE_SIZE
+1:
+ REG_L t8, (t1)
+ REG_S t8, (t2)
+ PTR_ADDIU t1, t1, SZREG
+ PTR_ADDIU t2, t2, SZREG
+ bne t1, t3, 1b
+ PTR_L t0, PBE_NEXT(t0)
+ bnez t0, 0b
+ //flush cache and tlb. no need?I am not sure.
+ PTR_L ra, saved_ra
+ PTR_L sp, saved_sp
+ PTR_L fp, saved_fp
+ PTR_L s0, saved_s0
+ PTR_L s1, saved_s1
+ PTR_L s2, saved_s2
+ PTR_L s3, saved_s3
+ PTR_L s4, saved_s4
+ PTR_L s5, saved_s5
+ PTR_L s6, saved_s6
+ PTR_L s7, saved_s7
+ PTR_L a0, saved_a0
+ PTR_L a1, saved_a1
+ PTR_L a2, saved_a2
+ PTR_L a3, saved_a3
+ PTR_LI v0, 0x0
+ PTR_L v1, saved_v1
+ jr ra
+ nop
+END(swsusp_arch_resume)
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index c7d9bb1..4ed4879 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -1,7 +1,7 @@
#ifndef _LINUX_SUSPEND_H
#define _LINUX_SUSPEND_H
-#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32)
|| defined(CONFIG_PPC64)
+#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32)
|| defined(CONFIG_PPC64) || defined(CONFIG_MIPS)
#include <asm/suspend.h>
#endif
#include <linux/swap.h>
--
1.6.2.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 25/30] loongson: Hibernation Support in mips system
2009-05-15 22:28 [PATCH 25/30] loongson: Hibernation Support in mips system Wu Zhangjin
@ 2009-05-15 22:28 ` Wu Zhangjin
2009-05-24 19:41 ` Pavel Machek
1 sibling, 0 replies; 4+ messages in thread
From: Wu Zhangjin @ 2009-05-15 22:28 UTC (permalink / raw)
To: linux-mips, Ralf Baechle, linux-kernel
Cc: Arnaud Patard, loongson-dev, zhangfx, yanh, Philippe Vachon,
Zhang Le, Erwan Lerale
From d4776f4891b9be96d357910f62d9ebaf898a3015 Mon Sep 17 00:00:00 2001
From: Wu Zhangjin <wuzhangjin@gmail.com>
Date: Sat, 16 May 2009 04:51:26 +0800
Subject: [PATCH 25/30] loongson: Hibernation Support in mips system
---
arch/mips/Kconfig | 3 +
arch/mips/Makefile | 3 +
arch/mips/include/asm/suspend.h | 2 +
arch/mips/kernel/asm-offsets.c | 13 ++++++
arch/mips/power/Makefile | 1 +
arch/mips/power/cpu.c | 48 ++++++++++++++++++++++++
arch/mips/power/hibernate.S | 78
+++++++++++++++++++++++++++++++++++++++
include/linux/suspend.h | 2 +-
8 files changed, 149 insertions(+), 1 deletions(-)
create mode 100644 arch/mips/power/Makefile
create mode 100644 arch/mips/power/cpu.c
create mode 100644 arch/mips/power/hibernate.S
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 68c12de..b14e866 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2130,6 +2130,9 @@ endmenu
menu "Power management options"
+config ARCH_HIBERNATION_POSSIBLE
+ def_bool y
+
config ARCH_SUSPEND_POSSIBLE
def_bool y
depends on !SMP
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index d73f084..8bde363 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -677,6 +677,9 @@ core-y += arch/mips/kernel/ arch/mips/mm/
arch/mips/math-emu/
drivers-$(CONFIG_OPROFILE) += arch/mips/oprofile/
+# suspend and hibernation support
+drivers-$(CONFIG_PM) += arch/mips/power/
+
ifdef CONFIG_LASAT
rom.bin rom.sw: vmlinux
$(Q)$(MAKE) $(build)=arch/mips/lasat/image $@
diff --git a/arch/mips/include/asm/suspend.h
b/arch/mips/include/asm/suspend.h
index 2562f8f..1d44287 100644
--- a/arch/mips/include/asm/suspend.h
+++ b/arch/mips/include/asm/suspend.h
@@ -3,4 +3,6 @@
/* Somewhen... Maybe :-) */
+static inline int arch_prepare_suspend(void) { return 0; }
+
#endif /* __ASM_SUSPEND_H */
diff --git a/arch/mips/kernel/asm-offsets.c
b/arch/mips/kernel/asm-offsets.c
index c901c22..94964f5 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -14,6 +14,7 @@
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/kbuild.h>
+#include <linux/suspend.h>
#include <asm/ptrace.h>
#include <asm/processor.h>
@@ -326,3 +327,15 @@ void output_octeon_cop2_state_defines(void)
BLANK();
}
#endif
+
+#ifdef CONFIG_HIBERNATION
+void output_pbe_defines(void)
+{
+ COMMENT(" Linux struct pbe offsets. ");
+ OFFSET(PBE_ADDRESS , pbe, address);
+ OFFSET(PBE_ORIG_ADDRESS , pbe, orig_address);
+ OFFSET(PBE_NEXT , pbe, next);
+ DEFINE(PBE_SIZE , sizeof(struct pbe));
+ BLANK();
+}
+#endif
diff --git a/arch/mips/power/Makefile b/arch/mips/power/Makefile
new file mode 100644
index 0000000..73d56b8
--- /dev/null
+++ b/arch/mips/power/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_HIBERNATION) += cpu.o hibernate.o
diff --git a/arch/mips/power/cpu.c b/arch/mips/power/cpu.c
new file mode 100644
index 0000000..b799bfe
--- /dev/null
+++ b/arch/mips/power/cpu.c
@@ -0,0 +1,48 @@
+/*
+ * Suspend support specific for mips.
+ *
+ */
+#include <linux/mm.h>
+#include <asm/mipsregs.h>
+#include <asm/page.h>
+#include <asm/suspend.h>
+
+/* References to section boundaries */
+extern const void __nosave_begin, __nosave_end;
+static uint32_t saved_status;
+unsigned long
+ saved_ra,
+ saved_sp,
+ saved_fp,
+ saved_gp,
+ saved_s0,
+ saved_s1,
+ saved_s2,
+ saved_s3,
+ saved_s4,
+ saved_s5,
+ saved_s6,
+ saved_s7,
+ saved_a0,
+ saved_a1,
+ saved_a2,
+ saved_a3,
+ saved_v0,
+ saved_v1;
+
+void save_processor_state(void)
+{
+ saved_status = read_c0_status();
+}
+
+void restore_processor_state(void)
+{
+ write_c0_status(saved_status);
+}
+
+int pfn_is_nosave(unsigned long pfn)
+{
+ unsigned long nosave_begin_pfn = __pa(&__nosave_begin) >> PAGE_SHIFT;
+ unsigned long nosave_end_pfn = PAGE_ALIGN(__pa(&__nosave_end)) >>
PAGE_SHIFT;
+ return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
+}
diff --git a/arch/mips/power/hibernate.S b/arch/mips/power/hibernate.S
new file mode 100644
index 0000000..e45ec45
--- /dev/null
+++ b/arch/mips/power/hibernate.S
@@ -0,0 +1,78 @@
+#incldue <linux/linkage.h>
+#include <asm/asm-offsets.h>
+#include <asm/regdef.h>
+#include <asm/asm.h>
+
+.text
+LEAF(swsusp_arch_suspend)
+ PTR_LA t0, saved_ra
+ PTR_S ra, (t0)
+ PTR_LA t0, saved_sp
+ PTR_S sp, (t0)
+ PTR_LA t0, saved_fp
+ PTR_S fp, (t0)
+ PTR_LA t0, saved_gp
+ PTR_S gp, (t0)
+ PTR_LA t0, saved_s0
+ PTR_S s0, (t0)
+ PTR_LA t0, saved_s1
+ PTR_S s1, (t0)
+ PTR_LA t0, saved_s2
+ PTR_S s2, (t0)
+ PTR_LA t0, saved_s3
+ PTR_S s3, (t0)
+ PTR_LA t0, saved_s4
+ PTR_S s4, (t0)
+ PTR_LA t0, saved_s5
+ PTR_S s5, (t0)
+ PTR_LA t0, saved_s6
+ PTR_S s6, (t0)
+ PTR_LA t0, saved_s7
+ PTR_S s7, (t0)
+ PTR_LA t0, saved_a0
+ PTR_S a0, (t0)
+ PTR_LA t0, saved_a1
+ PTR_S a1, (t0)
+ PTR_LA t0, saved_a2
+ PTR_S a2, (t0)
+ PTR_LA t0, saved_v1
+ PTR_S v1, (t0)
+ j swsusp_save
+ nop
+END(swsusp_arch_suspend)
+
+LEAF(swsusp_arch_resume)
+ PTR_L t0, restore_pblist
+0:
+ PTR_L t1, PBE_ADDRESS(t0) /* source */
+ PTR_L t2, PBE_ORIG_ADDRESS(t0) /* destination */
+ PTR_ADDIU t3, t1, _PAGE_SIZE
+1:
+ REG_L t8, (t1)
+ REG_S t8, (t2)
+ PTR_ADDIU t1, t1, SZREG
+ PTR_ADDIU t2, t2, SZREG
+ bne t1, t3, 1b
+ PTR_L t0, PBE_NEXT(t0)
+ bnez t0, 0b
+ //flush cache and tlb. no need?I am not sure.
+ PTR_L ra, saved_ra
+ PTR_L sp, saved_sp
+ PTR_L fp, saved_fp
+ PTR_L s0, saved_s0
+ PTR_L s1, saved_s1
+ PTR_L s2, saved_s2
+ PTR_L s3, saved_s3
+ PTR_L s4, saved_s4
+ PTR_L s5, saved_s5
+ PTR_L s6, saved_s6
+ PTR_L s7, saved_s7
+ PTR_L a0, saved_a0
+ PTR_L a1, saved_a1
+ PTR_L a2, saved_a2
+ PTR_L a3, saved_a3
+ PTR_LI v0, 0x0
+ PTR_L v1, saved_v1
+ jr ra
+ nop
+END(swsusp_arch_resume)
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index c7d9bb1..4ed4879 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -1,7 +1,7 @@
#ifndef _LINUX_SUSPEND_H
#define _LINUX_SUSPEND_H
-#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32)
|| defined(CONFIG_PPC64)
+#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32)
|| defined(CONFIG_PPC64) || defined(CONFIG_MIPS)
#include <asm/suspend.h>
#endif
#include <linux/swap.h>
--
1.6.2.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 25/30] loongson: Hibernation Support in mips system
2009-05-15 22:28 [PATCH 25/30] loongson: Hibernation Support in mips system Wu Zhangjin
2009-05-15 22:28 ` Wu Zhangjin
@ 2009-05-24 19:41 ` Pavel Machek
2009-05-25 1:12 ` Wu Zhangjin
1 sibling, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2009-05-24 19:41 UTC (permalink / raw)
To: Wu Zhangjin
Cc: linux-mips, Ralf Baechle, linux-kernel, Arnaud Patard,
loongson-dev, zhangfx, yanh, Philippe Vachon, Zhang Le,
Erwan Lerale
Hi!
> >From d4776f4891b9be96d357910f62d9ebaf898a3015 Mon Sep 17 00:00:00 2001
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> Date: Sat, 16 May 2009 04:51:26 +0800
> Subject: [PATCH 25/30] loongson: Hibernation Support in mips system
> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> index d73f084..8bde363 100644
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -677,6 +677,9 @@ core-y += arch/mips/kernel/ arch/mips/mm/
> arch/mips/math-emu/
>
> drivers-$(CONFIG_OPROFILE) += arch/mips/oprofile/
>
> +# suspend and hibernation support
> +drivers-$(CONFIG_PM) += arch/mips/power/
> +
Do all config combinations compile?
> @@ -3,4 +3,6 @@
>
> /* Somewhen... Maybe :-) */
>
> +static inline int arch_prepare_suspend(void) { return 0; }
> +
And kill the somewhen comment?
> @@ -326,3 +327,15 @@ void output_octeon_cop2_state_defines(void)
> BLANK();
> }
> #endif
> +
> +#ifdef CONFIG_HIBERNATION
> +void output_pbe_defines(void)
> +{
> + COMMENT(" Linux struct pbe offsets. ");
> + OFFSET(PBE_ADDRESS , pbe, address);
> + OFFSET(PBE_ORIG_ADDRESS , pbe, orig_address);
> + OFFSET(PBE_NEXT , pbe, next);
> + DEFINE(PBE_SIZE , sizeof(struct pbe));
> + BLANK();
> +}
> +#endif
What is this? please delete spaces before ,.
> diff --git a/arch/mips/power/hibernate.S b/arch/mips/power/hibernate.S
> new file mode 100644
> index 0000000..e45ec45
> --- /dev/null
> +++ b/arch/mips/power/hibernate.S
> @@ -0,0 +1,78 @@
> +#incldue <linux/linkage.h>
> +#include <asm/asm-offsets.h>
> +#include <asm/regdef.h>
> +#include <asm/asm.h>
> +
> +.text
> +LEAF(swsusp_arch_suspend)
> + PTR_LA t0, saved_ra
> + PTR_S ra, (t0)
> + PTR_LA t0, saved_sp
> + PTR_S sp, (t0)
> + PTR_LA t0, saved_fp
> + PTR_S fp, (t0)
> + PTR_LA t0, saved_gp
> + PTR_S gp, (t0)
> + PTR_LA t0, saved_s0
> + PTR_S s0, (t0)
> + PTR_LA t0, saved_s1
> + PTR_S s1, (t0)
> + PTR_LA t0, saved_s2
> + PTR_S s2, (t0)
> + PTR_LA t0, saved_s3
> + PTR_S s3, (t0)
> + PTR_LA t0, saved_s4
> + PTR_S s4, (t0)
> + PTR_LA t0, saved_s5
> + PTR_S s5, (t0)
> + PTR_LA t0, saved_s6
> + PTR_S s6, (t0)
> + PTR_LA t0, saved_s7
> + PTR_S s7, (t0)
> + PTR_LA t0, saved_a0
> + PTR_S a0, (t0)
> + PTR_LA t0, saved_a1
> + PTR_S a1, (t0)
> + PTR_LA t0, saved_a2
> + PTR_S a2, (t0)
> + PTR_LA t0, saved_v1
> + PTR_S v1, (t0)
> + j swsusp_save
> + nop
> +END(swsusp_arch_suspend)
> +
> +LEAF(swsusp_arch_resume)
> + PTR_L t0, restore_pblist
> +0:
> + PTR_L t1, PBE_ADDRESS(t0) /* source */
> + PTR_L t2, PBE_ORIG_ADDRESS(t0) /* destination */
> + PTR_ADDIU t3, t1, _PAGE_SIZE
> +1:
> + REG_L t8, (t1)
> + REG_S t8, (t2)
> + PTR_ADDIU t1, t1, SZREG
> + PTR_ADDIU t2, t2, SZREG
> + bne t1, t3, 1b
> + PTR_L t0, PBE_NEXT(t0)
> + bnez t0, 0b
> + //flush cache and tlb. no need?I am not sure.
Avoid c++ comments... and yes, I guess you should flush cache/tlb.
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 25/30] loongson: Hibernation Support in mips system
2009-05-24 19:41 ` Pavel Machek
@ 2009-05-25 1:12 ` Wu Zhangjin
0 siblings, 0 replies; 4+ messages in thread
From: Wu Zhangjin @ 2009-05-25 1:12 UTC (permalink / raw)
To: Pavel Machek
Cc: linux-mips, Ralf Baechle, linux-kernel, Arnaud Patard,
loongson-dev, zhangfx, yanh, Philippe Vachon, Zhang Le,
Erwan Lerale, huhb
On Sun, 2009-05-24 at 21:41 +0200, Pavel Machek wrote:
> Hi!
>
sorry, this is an old version without check via scripts/checkpatch.pl,
please ignore it, the latest version goes here:
[loongson-PATCH-v1 22/27] Hibernation Support in mips system
and the above one is also out of date, can not apply to the latest
linux-mip development git repo(-rc7). so, please also ignore it, i am
working on a new version of it in the latest linux-mips git tree. and
will apply the existing feedbacks from the mailing list.
thanks!
Wu Zhangjin
> > >From d4776f4891b9be96d357910f62d9ebaf898a3015 Mon Sep 17 00:00:00 2001
> > From: Wu Zhangjin <wuzhangjin@gmail.com>
> > Date: Sat, 16 May 2009 04:51:26 +0800
> > Subject: [PATCH 25/30] loongson: Hibernation Support in mips system
>
> > diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> > index d73f084..8bde363 100644
> > --- a/arch/mips/Makefile
> > +++ b/arch/mips/Makefile
> > @@ -677,6 +677,9 @@ core-y += arch/mips/kernel/ arch/mips/mm/
> > arch/mips/math-emu/
> >
> > drivers-$(CONFIG_OPROFILE) += arch/mips/oprofile/
> >
> > +# suspend and hibernation support
> > +drivers-$(CONFIG_PM) += arch/mips/power/
> > +
>
> Do all config combinations compile?
>
> > @@ -3,4 +3,6 @@
> >
> > /* Somewhen... Maybe :-) */
> >
> > +static inline int arch_prepare_suspend(void) { return 0; }
> > +
>
> And kill the somewhen comment?
>
> > @@ -326,3 +327,15 @@ void output_octeon_cop2_state_defines(void)
> > BLANK();
> > }
> > #endif
> > +
> > +#ifdef CONFIG_HIBERNATION
> > +void output_pbe_defines(void)
> > +{
> > + COMMENT(" Linux struct pbe offsets. ");
> > + OFFSET(PBE_ADDRESS , pbe, address);
> > + OFFSET(PBE_ORIG_ADDRESS , pbe, orig_address);
> > + OFFSET(PBE_NEXT , pbe, next);
> > + DEFINE(PBE_SIZE , sizeof(struct pbe));
> > + BLANK();
> > +}
> > +#endif
>
> What is this? please delete spaces before ,.
>
>
>
>
> > diff --git a/arch/mips/power/hibernate.S b/arch/mips/power/hibernate.S
> > new file mode 100644
> > index 0000000..e45ec45
> > --- /dev/null
> > +++ b/arch/mips/power/hibernate.S
> > @@ -0,0 +1,78 @@
> > +#incldue <linux/linkage.h>
> > +#include <asm/asm-offsets.h>
> > +#include <asm/regdef.h>
> > +#include <asm/asm.h>
> > +
> > +.text
> > +LEAF(swsusp_arch_suspend)
> > + PTR_LA t0, saved_ra
> > + PTR_S ra, (t0)
> > + PTR_LA t0, saved_sp
> > + PTR_S sp, (t0)
> > + PTR_LA t0, saved_fp
> > + PTR_S fp, (t0)
> > + PTR_LA t0, saved_gp
> > + PTR_S gp, (t0)
> > + PTR_LA t0, saved_s0
> > + PTR_S s0, (t0)
> > + PTR_LA t0, saved_s1
> > + PTR_S s1, (t0)
> > + PTR_LA t0, saved_s2
> > + PTR_S s2, (t0)
> > + PTR_LA t0, saved_s3
> > + PTR_S s3, (t0)
> > + PTR_LA t0, saved_s4
> > + PTR_S s4, (t0)
> > + PTR_LA t0, saved_s5
> > + PTR_S s5, (t0)
> > + PTR_LA t0, saved_s6
> > + PTR_S s6, (t0)
> > + PTR_LA t0, saved_s7
> > + PTR_S s7, (t0)
> > + PTR_LA t0, saved_a0
> > + PTR_S a0, (t0)
> > + PTR_LA t0, saved_a1
> > + PTR_S a1, (t0)
> > + PTR_LA t0, saved_a2
> > + PTR_S a2, (t0)
> > + PTR_LA t0, saved_v1
> > + PTR_S v1, (t0)
> > + j swsusp_save
> > + nop
> > +END(swsusp_arch_suspend)
> > +
> > +LEAF(swsusp_arch_resume)
> > + PTR_L t0, restore_pblist
> > +0:
> > + PTR_L t1, PBE_ADDRESS(t0) /* source */
> > + PTR_L t2, PBE_ORIG_ADDRESS(t0) /* destination */
> > + PTR_ADDIU t3, t1, _PAGE_SIZE
> > +1:
> > + REG_L t8, (t1)
> > + REG_S t8, (t2)
> > + PTR_ADDIU t1, t1, SZREG
> > + PTR_ADDIU t2, t2, SZREG
> > + bne t1, t3, 1b
> > + PTR_L t0, PBE_NEXT(t0)
> > + bnez t0, 0b
> > + //flush cache and tlb. no need?I am not sure.
>
> Avoid c++ comments... and yes, I guess you should flush cache/tlb.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-05-25 1:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-15 22:28 [PATCH 25/30] loongson: Hibernation Support in mips system Wu Zhangjin
2009-05-15 22:28 ` Wu Zhangjin
2009-05-24 19:41 ` Pavel Machek
2009-05-25 1:12 ` Wu Zhangjin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).