arch/mips/kernel/reset.c
Source file repositories/reference/linux-study-clean/arch/mips/kernel/reset.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/kernel/reset.c- Extension
.c- Size
- 2885 bytes
- Lines
- 125
- Domain
- Architecture Layer
- Bucket
- arch/mips
- 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.
Dependency Surface
linux/kernel.hlinux/export.hlinux/pm.hlinux/types.hlinux/reboot.hlinux/delay.hasm/compiler.hasm/idle.hasm/mipsregs.hasm/reboot.h
Detected Declarations
function machine_hangfunction machine_restartfunction machine_haltfunction machine_power_offexport pm_power_off
Annotated Snippet
if (cpu_has_mips_r) {
/*
* We know that the wait instruction is supported so
* make use of it directly, leaving interrupts
* disabled.
*/
asm volatile(
".set push\n\t"
".set " MIPS_ISA_ARCH_LEVEL "\n\t"
"wait\n\t"
".set pop");
} else if (cpu_wait) {
/*
* Try the cpu_wait() callback. This isn't ideal since
* it'll re-enable interrupts, but that ought to be
* harmless given that they're all masked.
*/
cpu_wait();
local_irq_disable();
} else {
/*
* We're going to burn some power running round the
* loop, but we don't really have a choice. This isn't
* a path we should expect to run for long during
* typical use anyway.
*/
}
/*
* In most modern MIPS CPUs interrupts will cause the wait
* instruction to graduate even when disabled, and in some
* cases even when masked. In order to prevent a timer
* interrupt from continuously taking us out of the low power
* wait state, we clear any pending timer interrupt here.
*/
if (cpu_has_counter)
write_c0_compare(0);
}
}
void machine_restart(char *command)
{
if (_machine_restart)
_machine_restart(command);
#ifdef CONFIG_SMP
preempt_disable();
smp_send_stop();
#endif
do_kernel_restart(command);
mdelay(1000);
pr_emerg("Reboot failed -- System halted\n");
machine_hang();
}
void machine_halt(void)
{
if (_machine_halt)
_machine_halt();
#ifdef CONFIG_SMP
preempt_disable();
smp_send_stop();
#endif
machine_hang();
}
void machine_power_off(void)
{
do_kernel_power_off();
#ifdef CONFIG_SMP
preempt_disable();
smp_send_stop();
#endif
machine_hang();
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/export.h`, `linux/pm.h`, `linux/types.h`, `linux/reboot.h`, `linux/delay.h`, `asm/compiler.h`, `asm/idle.h`.
- Detected declarations: `function machine_hang`, `function machine_restart`, `function machine_halt`, `function machine_power_off`, `export pm_power_off`.
- Atlas domain: Architecture Layer / arch/mips.
- 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.