arch/parisc/kernel/toc.c
Source file repositories/reference/linux-study-clean/arch/parisc/kernel/toc.c
File Facts
- System
- Linux kernel
- Corpus path
arch/parisc/kernel/toc.c- Extension
.c- Size
- 3124 bytes
- Lines
- 127
- Domain
- Architecture Layer
- Bucket
- arch/parisc
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/kgdb.hlinux/printk.hlinux/sched/debug.hlinux/delay.hlinux/reboot.hasm/pdc.hasm/pdc_chassis.hasm/ldcw.hasm/processor.h
Detected Declarations
function toc20_to_pt_regsfunction toc11_to_pt_regsfunction toc_intrfunction setup_toc
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include <linux/kgdb.h>
#include <linux/printk.h>
#include <linux/sched/debug.h>
#include <linux/delay.h>
#include <linux/reboot.h>
#include <asm/pdc.h>
#include <asm/pdc_chassis.h>
#include <asm/ldcw.h>
#include <asm/processor.h>
static unsigned int __aligned(16) toc_lock = 1;
DEFINE_PER_CPU_PAGE_ALIGNED(char [16384], toc_stack) __visible;
static void toc20_to_pt_regs(struct pt_regs *regs, struct pdc_toc_pim_20 *toc)
{
int i;
regs->gr[0] = (unsigned long)toc->cr[22];
for (i = 1; i < 32; i++)
regs->gr[i] = (unsigned long)toc->gr[i];
for (i = 0; i < 8; i++)
regs->sr[i] = (unsigned long)toc->sr[i];
regs->iasq[0] = (unsigned long)toc->cr[17];
regs->iasq[1] = (unsigned long)toc->iasq_back;
regs->iaoq[0] = (unsigned long)toc->cr[18];
regs->iaoq[1] = (unsigned long)toc->iaoq_back;
regs->sar = (unsigned long)toc->cr[11];
regs->iir = (unsigned long)toc->cr[19];
regs->isr = (unsigned long)toc->cr[20];
regs->ior = (unsigned long)toc->cr[21];
}
static void toc11_to_pt_regs(struct pt_regs *regs, struct pdc_toc_pim_11 *toc)
{
int i;
regs->gr[0] = toc->cr[22];
for (i = 1; i < 32; i++)
regs->gr[i] = toc->gr[i];
for (i = 0; i < 8; i++)
regs->sr[i] = toc->sr[i];
regs->iasq[0] = toc->cr[17];
regs->iasq[1] = toc->iasq_back;
regs->iaoq[0] = toc->cr[18];
regs->iaoq[1] = toc->iaoq_back;
regs->sar = toc->cr[11];
regs->iir = toc->cr[19];
regs->isr = toc->cr[20];
regs->ior = toc->cr[21];
}
void notrace __noreturn __cold toc_intr(struct pt_regs *regs)
{
struct pdc_toc_pim_20 pim_data20;
struct pdc_toc_pim_11 pim_data11;
/* verify we wrote regs to the correct stack */
BUG_ON(regs != (struct pt_regs *)&per_cpu(toc_stack, raw_smp_processor_id()));
if (boot_cpu_data.cpu_type >= pcxu) {
if (pdc_pim_toc20(&pim_data20))
panic("Failed to get PIM data");
toc20_to_pt_regs(regs, &pim_data20);
} else {
if (pdc_pim_toc11(&pim_data11))
panic("Failed to get PIM data");
toc11_to_pt_regs(regs, &pim_data11);
}
#ifdef CONFIG_KGDB
nmi_enter();
if (atomic_read(&kgdb_active) != -1)
kgdb_nmicallback(raw_smp_processor_id(), regs);
kgdb_handle_exception(9, SIGTRAP, 0, regs);
#endif
/* serialize output, otherwise all CPUs write backtrace at once */
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/kgdb.h`, `linux/printk.h`, `linux/sched/debug.h`, `linux/delay.h`, `linux/reboot.h`, `asm/pdc.h`, `asm/pdc_chassis.h`.
- Detected declarations: `function toc20_to_pt_regs`, `function toc11_to_pt_regs`, `function toc_intr`, `function setup_toc`.
- Atlas domain: Architecture Layer / arch/parisc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.