arch/loongarch/power/suspend.c
Source file repositories/reference/linux-study-clean/arch/loongarch/power/suspend.c
File Facts
- System
- Linux kernel
- Corpus path
arch/loongarch/power/suspend.c- Extension
.c- Size
- 1878 bytes
- Lines
- 76
- Domain
- Architecture Layer
- Bucket
- arch/loongarch
- Inferred role
- Architecture Layer: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/pm.hlinux/suspend.hasm/loongarch.hasm/loongson.hasm/setup.hasm/time.hasm/tlbflush.h
Detected Declarations
struct saved_registersfunction loongarch_common_suspendfunction loongarch_common_resumefunction loongarch_acpi_suspend
Annotated Snippet
struct saved_registers {
u32 ecfg;
u32 euen;
u32 pwctl0;
u32 pwctl1;
unsigned long pgd;
unsigned long kpgd;
unsigned long pcpu_base;
};
static struct saved_registers saved_regs;
void loongarch_common_suspend(void)
{
save_counter();
saved_regs.pgd = csr_read(LOONGARCH_CSR_PGDL);
saved_regs.kpgd = csr_read(LOONGARCH_CSR_PGDH);
saved_regs.pwctl0 = csr_read32(LOONGARCH_CSR_PWCTL0);
saved_regs.pwctl1 = csr_read32(LOONGARCH_CSR_PWCTL1);
saved_regs.ecfg = csr_read32(LOONGARCH_CSR_ECFG);
saved_regs.euen = csr_read32(LOONGARCH_CSR_EUEN);
saved_regs.pcpu_base = csr_read(PERCPU_BASE_KS);
loongarch_suspend_addr = loongson_sysconf.suspend_addr;
}
void loongarch_common_resume(void)
{
sync_counter();
local_flush_tlb_all();
csr_write(eentry, LOONGARCH_CSR_EENTRY);
csr_write(eentry, LOONGARCH_CSR_MERRENTRY);
csr_write(tlbrentry, LOONGARCH_CSR_TLBRENTRY);
csr_write(saved_regs.pgd, LOONGARCH_CSR_PGDL);
csr_write(saved_regs.kpgd, LOONGARCH_CSR_PGDH);
csr_write32(saved_regs.pwctl0, LOONGARCH_CSR_PWCTL0);
csr_write32(saved_regs.pwctl1, LOONGARCH_CSR_PWCTL1);
csr_write32(saved_regs.ecfg, LOONGARCH_CSR_ECFG);
csr_write32(saved_regs.euen, LOONGARCH_CSR_EUEN);
csr_write(saved_regs.pcpu_base, PERCPU_BASE_KS);
}
int loongarch_acpi_suspend(void)
{
enable_gpe_wakeup();
enable_pci_wakeup();
loongarch_common_suspend();
/* processor specific suspend */
loongarch_suspend_enter();
loongarch_common_resume();
return 0;
}
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/pm.h`, `linux/suspend.h`, `asm/loongarch.h`, `asm/loongson.h`, `asm/setup.h`, `asm/time.h`, `asm/tlbflush.h`.
- Detected declarations: `struct saved_registers`, `function loongarch_common_suspend`, `function loongarch_common_resume`, `function loongarch_acpi_suspend`.
- Atlas domain: Architecture Layer / arch/loongarch.
- Implementation status: source 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.