arch/sh/kernel/reboot.c
Source file repositories/reference/linux-study-clean/arch/sh/kernel/reboot.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sh/kernel/reboot.c- Extension
.c- Size
- 1724 bytes
- Lines
- 97
- Domain
- Architecture Layer
- Bucket
- arch/sh
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pm.hlinux/kexec.hlinux/kernel.hlinux/reboot.hlinux/module.hasm/watchdog.hasm/addrspace.hasm/reboot.hasm/tlbflush.hasm/traps.h
Detected Declarations
function watchdog_trigger_immediatefunction native_machine_restartfunction native_machine_shutdownfunction native_machine_power_offfunction native_machine_haltfunction machine_power_offfunction machine_shutdownfunction machine_restartfunction machine_haltfunction machine_crash_shutdownexport pm_power_off
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <linux/pm.h>
#include <linux/kexec.h>
#include <linux/kernel.h>
#include <linux/reboot.h>
#include <linux/module.h>
#include <asm/watchdog.h>
#include <asm/addrspace.h>
#include <asm/reboot.h>
#include <asm/tlbflush.h>
#include <asm/traps.h>
void (*pm_power_off)(void);
EXPORT_SYMBOL(pm_power_off);
static void watchdog_trigger_immediate(void)
{
sh_wdt_write_cnt(0xFF);
sh_wdt_write_csr(0xC2);
}
static void native_machine_restart(char * __unused)
{
local_irq_disable();
/* Destroy all of the TLBs in preparation for reset by MMU */
__flush_tlb_global();
/* Address error with SR.BL=1 first. */
trigger_address_error();
/* If that fails or is unsupported, go for the watchdog next. */
watchdog_trigger_immediate();
/*
* Give up and sleep.
*/
while (1)
cpu_sleep();
}
static void native_machine_shutdown(void)
{
smp_send_stop();
}
static void native_machine_power_off(void)
{
do_kernel_power_off();
}
static void native_machine_halt(void)
{
/* stop other cpus */
machine_shutdown();
/* stop this cpu */
stop_this_cpu(NULL);
}
struct machine_ops machine_ops = {
.power_off = native_machine_power_off,
.shutdown = native_machine_shutdown,
.restart = native_machine_restart,
.halt = native_machine_halt,
#ifdef CONFIG_KEXEC_CORE
.crash_shutdown = native_machine_crash_shutdown,
#endif
};
void machine_power_off(void)
{
machine_ops.power_off();
}
void machine_shutdown(void)
{
machine_ops.shutdown();
}
void machine_restart(char *cmd)
{
machine_ops.restart(cmd);
}
void machine_halt(void)
{
machine_ops.halt();
}
Annotation
- Immediate include surface: `linux/pm.h`, `linux/kexec.h`, `linux/kernel.h`, `linux/reboot.h`, `linux/module.h`, `asm/watchdog.h`, `asm/addrspace.h`, `asm/reboot.h`.
- Detected declarations: `function watchdog_trigger_immediate`, `function native_machine_restart`, `function native_machine_shutdown`, `function native_machine_power_off`, `function native_machine_halt`, `function machine_power_off`, `function machine_shutdown`, `function machine_restart`, `function machine_halt`, `function machine_crash_shutdown`.
- Atlas domain: Architecture Layer / arch/sh.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.