aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/cpu/sh3/entry.S
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2009-03-06 04:47:02 -0500
committerPaul Mundt <lethal@linux-sh.org>2009-03-09 23:55:40 -0400
commit2ef7f0dab6b3d171b6aff00a47077385ae3155b5 (patch)
tree6066996e7dfc65b02470ae4c1c96c6c7c70965a6 /arch/sh/kernel/cpu/sh3/entry.S
parentedab56f4c90f45ba4e61d06d3fc9658da4e94bde (diff)
sh: hibernation support
Add Suspend-to-disk / swsusp / CONFIG_HIBERNATION support to the SuperH architecture. To suspend, use "swapon /dev/sda2; echo disk > /sys/power/state" To resume, pass "resume=/dev/sda2" on the kernel command line. The patch "pm: rework includes, remove arch ifdefs V2" is needed to allow the generic swsusp code to build properly. Hibernation is not enabled with this patch though, a patch setting ARCH_HIBERNATION_POSSIBLE will be submitted later. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/cpu/sh3/entry.S')
-rw-r--r--arch/sh/kernel/cpu/sh3/entry.S22
1 files changed, 17 insertions, 5 deletions
diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S
index c4829d6dee51..fba6ac20bb17 100644
--- a/arch/sh/kernel/cpu/sh3/entry.S
+++ b/arch/sh/kernel/cpu/sh3/entry.S
@@ -216,7 +216,7 @@ ENTRY(sh_bios_handler)
216! r9 trashed 216! r9 trashed
217! BL=0 on entry, on exit BL=1 (depending on r8). 217! BL=0 on entry, on exit BL=1 (depending on r8).
218 218
219restore_regs: 219ENTRY(restore_regs)
220 mov.l @r15+, r0 220 mov.l @r15+, r0
221 mov.l @r15+, r1 221 mov.l @r15+, r1
222 mov.l @r15+, r2 222 mov.l @r15+, r2
@@ -362,8 +362,10 @@ general_exception:
362 nop 362 nop
363 363
364 ! Save registers / Switch to bank 0 364 ! Save registers / Switch to bank 0
365 mov.l k4, k2 ! keep vector in k2
366 mov.l 1f, k4 ! SR bits to clear in k4
365 bsr save_regs ! needs original pr value in k3 367 bsr save_regs ! needs original pr value in k3
366 mov k4, k2 ! keep vector in k2 368 nop
367 369
368 bra handle_exception_special 370 bra handle_exception_special
369 nop 371 nop
@@ -471,6 +473,7 @@ handle_exception:
471 473
472 ! Save registers / Switch to bank 0 474 ! Save registers / Switch to bank 0
473 mov.l 5f, k2 ! vector register address 475 mov.l 5f, k2 ! vector register address
476 mov.l 1f, k4 ! SR bits to clear in k4
474 bsr save_regs ! needs original pr value in k3 477 bsr save_regs ! needs original pr value in k3
475 mov.l @k2, k2 ! read out vector and keep in k2 478 mov.l @k2, k2 ! read out vector and keep in k2
476 479
@@ -495,10 +498,10 @@ handle_exception_special:
495! k0 contains original stack pointer* 498! k0 contains original stack pointer*
496! k1 trashed 499! k1 trashed
497! k3 passes original pr* 500! k3 passes original pr*
498! k4 trashed 501! k4 passes SR bitmask
499! BL=1 on entry, on exit BL=0. 502! BL=1 on entry, on exit BL=0.
500 503
501save_regs: 504ENTRY(save_regs)
502 mov #-1, r1 505 mov #-1, r1
503 mov.l k1, @-r15 ! set TRA (default: -1) 506 mov.l k1, @-r15 ! set TRA (default: -1)
504 sts.l macl, @-r15 507 sts.l macl, @-r15
@@ -518,8 +521,16 @@ save_regs:
518 mov.l r8, @-r15 521 mov.l r8, @-r15
519 522
520 mov.l 0f, k3 ! SR bits to set in k3 523 mov.l 0f, k3 ! SR bits to set in k3
521 mov.l 1f, k4 ! SR bits to clear in k4
522 524
525 ! fall-through
526
527! save_low_regs()
528! - modify SR for bank switch
529! - save r7, r6, r5, r4, r3, r2, r1, r0 on the stack
530! k3 passes bits to set in SR
531! k4 passes bits to clear in SR
532
533ENTRY(save_low_regs)
523 stc sr, r8 534 stc sr, r8
524 or k3, r8 535 or k3, r8
525 and k4, r8 536 and k4, r8
@@ -565,6 +576,7 @@ ENTRY(handle_interrupt)
565 PREF(k0) 576 PREF(k0)
566 577
567 ! Save registers / Switch to bank 0 578 ! Save registers / Switch to bank 0
579 mov.l 1f, k4 ! SR bits to clear in k4
568 bsr save_regs ! needs original pr value in k3 580 bsr save_regs ! needs original pr value in k3
569 mov #-1, k2 ! default vector kept in k2 581 mov #-1, k2 ! default vector kept in k2
570 582