~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/sh/kernel/reboot.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 #include <linux/pm.h>
  3 #include <linux/kexec.h>
  4 #include <linux/kernel.h>
  5 #include <linux/reboot.h>
  6 #include <linux/module.h>
  7 #include <asm/watchdog.h>
  8 #include <asm/addrspace.h>
  9 #include <asm/reboot.h>
 10 #include <asm/tlbflush.h>
 11 #include <asm/traps.h>
 12 
 13 void (*pm_power_off)(void);
 14 EXPORT_SYMBOL(pm_power_off);
 15 
 16 static void watchdog_trigger_immediate(void)
 17 {
 18         sh_wdt_write_cnt(0xFF);
 19         sh_wdt_write_csr(0xC2);
 20 }
 21 
 22 static void native_machine_restart(char * __unused)
 23 {
 24         local_irq_disable();
 25 
 26         /* Destroy all of the TLBs in preparation for reset by MMU */
 27         __flush_tlb_global();
 28 
 29         /* Address error with SR.BL=1 first. */
 30         trigger_address_error();
 31 
 32         /* If that fails or is unsupported, go for the watchdog next. */
 33         watchdog_trigger_immediate();
 34 
 35         /*
 36          * Give up and sleep.
 37          */
 38         while (1)
 39                 cpu_sleep();
 40 }
 41 
 42 static void native_machine_shutdown(void)
 43 {
 44         smp_send_stop();
 45 }
 46 
 47 static void native_machine_power_off(void)
 48 {
 49         do_kernel_power_off();
 50 }
 51 
 52 static void native_machine_halt(void)
 53 {
 54         /* stop other cpus */
 55         machine_shutdown();
 56 
 57         /* stop this cpu */
 58         stop_this_cpu(NULL);
 59 }
 60 
 61 struct machine_ops machine_ops = {
 62         .power_off      = native_machine_power_off,
 63         .shutdown       = native_machine_shutdown,
 64         .restart        = native_machine_restart,
 65         .halt           = native_machine_halt,
 66 #ifdef CONFIG_KEXEC_CORE
 67         .crash_shutdown = native_machine_crash_shutdown,
 68 #endif
 69 };
 70 
 71 void machine_power_off(void)
 72 {
 73         machine_ops.power_off();
 74 }
 75 
 76 void machine_shutdown(void)
 77 {
 78         machine_ops.shutdown();
 79 }
 80 
 81 void machine_restart(char *cmd)
 82 {
 83         machine_ops.restart(cmd);
 84 }
 85 
 86 void machine_halt(void)
 87 {
 88         machine_ops.halt();
 89 }
 90 
 91 #ifdef CONFIG_KEXEC_CORE
 92 void machine_crash_shutdown(struct pt_regs *regs)
 93 {
 94         machine_ops.crash_shutdown(regs);
 95 }
 96 #endif
 97 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php