arch/loongarch/kernel/reset.c
Source file repositories/reference/linux-study-clean/arch/loongarch/kernel/reset.c
File Facts
- System
- Linux kernel
- Corpus path
arch/loongarch/kernel/reset.c- Extension
.c- Size
- 1532 bytes
- Lines
- 80
- Domain
- Architecture Layer
- Bucket
- arch/loongarch
- 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/acpi.hlinux/efi.hlinux/export.hlinux/pm.hlinux/types.hlinux/reboot.hlinux/delay.hlinux/console.hacpi/reboot.hasm/idle.hasm/loongarch.hasm/loongson.h
Detected Declarations
function machine_haltfunction machine_power_offfunction machine_restartexport pm_power_off
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2020-2022 Loongson Technology Corporation Limited
*/
#include <linux/kernel.h>
#include <linux/acpi.h>
#include <linux/efi.h>
#include <linux/export.h>
#include <linux/pm.h>
#include <linux/types.h>
#include <linux/reboot.h>
#include <linux/delay.h>
#include <linux/console.h>
#include <acpi/reboot.h>
#include <asm/idle.h>
#include <asm/loongarch.h>
#include <asm/loongson.h>
void (*pm_power_off)(void);
EXPORT_SYMBOL(pm_power_off);
void machine_halt(void)
{
#ifdef CONFIG_SMP
preempt_disable();
smp_send_stop();
#endif
local_irq_disable();
clear_csr_ecfg(ECFG0_IM);
pr_notice("\n\n** You can safely turn off the power now **\n\n");
console_flush_on_panic(CONSOLE_FLUSH_PENDING);
while (true) {
__asm__ __volatile__("idle 0" : : : "memory");
}
}
void machine_power_off(void)
{
#ifdef CONFIG_SMP
preempt_disable();
smp_send_stop();
#endif
#ifdef CONFIG_PM
if (!acpi_disabled)
enable_pci_wakeup();
#endif
do_kernel_power_off();
#ifdef CONFIG_EFI
efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
#endif
while (true) {
__asm__ __volatile__("idle 0" : : : "memory");
}
}
void machine_restart(char *command)
{
#ifdef CONFIG_SMP
preempt_disable();
smp_send_stop();
#endif
do_kernel_restart(command);
#ifdef CONFIG_EFI
if (efi_capsule_pending(NULL))
efi_reboot(REBOOT_WARM, NULL);
else
efi_reboot(REBOOT_COLD, NULL);
#endif
if (!acpi_disabled)
acpi_reboot();
while (true) {
__asm__ __volatile__("idle 0" : : : "memory");
}
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/acpi.h`, `linux/efi.h`, `linux/export.h`, `linux/pm.h`, `linux/types.h`, `linux/reboot.h`, `linux/delay.h`.
- Detected declarations: `function machine_halt`, `function machine_power_off`, `function machine_restart`, `export pm_power_off`.
- Atlas domain: Architecture Layer / arch/loongarch.
- 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.