x86/efi: Enforce CONFIG_RELOCATABLE for EFI boot stub
[linux/fpc-iii.git] / arch / mips / loongson / common / reset.c
blob65bfbb5d06f442efbd6601600097f94124cc171c
1 /*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
7 * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
8 * Author: Fuxin Zhang, zhangfx@lemote.com
9 * Copyright (C) 2009 Lemote, Inc.
10 * Author: Zhangjin Wu, wuzhangjin@gmail.com
12 #include <linux/init.h>
13 #include <linux/pm.h>
15 #include <asm/idle.h>
16 #include <asm/reboot.h>
18 #include <loongson.h>
20 static inline void loongson_reboot(void)
22 #ifndef CONFIG_CPU_JUMP_WORKAROUNDS
23 ((void (*)(void))ioremap_nocache(LOONGSON_BOOT_BASE, 4)) ();
24 #else
25 void (*func)(void);
27 func = (void *)ioremap_nocache(LOONGSON_BOOT_BASE, 4);
29 __asm__ __volatile__(
30 " .set noat \n"
31 " jr %[func] \n"
32 " .set at \n"
33 : /* No outputs */
34 : [func] "r" (func));
35 #endif
38 static void loongson_restart(char *command)
40 /* do preparation for reboot */
41 mach_prepare_reboot();
43 /* reboot via jumping to boot base address */
44 loongson_reboot();
47 static void loongson_poweroff(void)
49 mach_prepare_shutdown();
50 unreachable();
53 static void loongson_halt(void)
55 pr_notice("\n\n** You can safely turn off the power now **\n\n");
56 while (1) {
57 if (cpu_wait)
58 cpu_wait();
62 static int __init mips_reboot_setup(void)
64 _machine_restart = loongson_restart;
65 _machine_halt = loongson_halt;
66 pm_power_off = loongson_poweroff;
68 return 0;
71 arch_initcall(mips_reboot_setup);