arch/powerpc/platforms/powermac/smp.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/powermac/smp.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/powermac/smp.c- Extension
.c- Size
- 25145 bytes
- Lines
- 1028
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/sched.hlinux/sched/hotplug.hlinux/smp.hlinux/interrupt.hlinux/irqdomain.hlinux/kernel_stat.hlinux/delay.hlinux/init.hlinux/spinlock.hlinux/errno.hlinux/hardirq.hlinux/cpu.hlinux/compiler.hlinux/pgtable.hasm/ptrace.hlinux/atomic.hasm/text-patching.hasm/irq.hasm/page.hasm/sections.hasm/io.hasm/smp.hasm/machdep.hasm/pmac_feature.hasm/time.hasm/mpic.hasm/cacheflush.hasm/keylargo.hasm/pmac_low_i2c.hasm/pmac_pfunc.hasm/inst.h
Detected Declarations
function psurge_set_ipifunction psurge_clr_ipifunction powersurgefunction smp_psurge_cause_ipifunction psurge_host_mapfunction psurge_secondary_ipi_initfunction psurge_quad_probefunction psurge_quad_initfunction smp_psurge_probefunction smp_psurge_kick_cpufunction smp_psurge_setup_cpufunction smp_psurge_take_timebasefunction smp_psurge_give_timebasefunction smp_core99_give_timebasefunction smp_core99_take_timebasefunction smp_core99_cypress_tb_freezefunction smp_core99_pulsar_tb_freezefunction smp_core99_setup_i2c_hwsyncfunction smp_core99_pfunc_tb_freezefunction smp_core99_gpio_tb_freezefunction core99_init_cachesfunction smp_core99_setupfunction smp_core99_probefunction smp_core99_kick_cpufunction smp_core99_setup_cpufunction smp_core99_cpu_preparefunction smp_core99_cpu_onlinefunction smp_core99_bringup_donefunction num_online_cpusfunction smp_core99_cpu_disablefunction pmac_cpu_offline_selffunction pmac_cpu_offline_selffunction pmac_setup_smp
Annotated Snippet
switch(psurge_type) {
case PSURGE_DUAL:
out_8(psurge_sec_intr, ~0);
break;
case PSURGE_NONE:
break;
default:
PSURGE_QUAD_OUT(PSURGE_QUAD_IRQ_CLR, 1 << cpu);
}
}
}
/*
* On powersurge (old SMP powermac architecture) we don't have
* separate IPIs for separate messages like openpic does. Instead
* use the generic demux helpers
* -- paulus.
*/
static irqreturn_t psurge_ipi_intr(int irq, void *d)
{
psurge_clr_ipi(smp_processor_id());
smp_ipi_demux();
return IRQ_HANDLED;
}
static void smp_psurge_cause_ipi(int cpu)
{
psurge_set_ipi(cpu);
}
static int psurge_host_map(struct irq_domain *h, unsigned int virq,
irq_hw_number_t hw)
{
irq_set_chip_and_handler(virq, &dummy_irq_chip, handle_percpu_irq);
return 0;
}
static const struct irq_domain_ops psurge_host_ops = {
.map = psurge_host_map,
};
static int __init psurge_secondary_ipi_init(void)
{
int rc = -ENOMEM;
psurge_host = irq_domain_create_nomap(NULL, ~0, &psurge_host_ops, NULL);
if (psurge_host)
psurge_secondary_virq = irq_create_direct_mapping(psurge_host);
if (psurge_secondary_virq)
rc = request_irq(psurge_secondary_virq, psurge_ipi_intr,
IRQF_PERCPU | IRQF_NO_THREAD, "IPI", NULL);
if (rc)
pr_err("Failed to setup secondary cpu IPI\n");
return rc;
}
/*
* Determine a quad card presence. We read the board ID register, we
* force the data bus to change to something else, and we read it again.
* It it's stable, then the register probably exist (ugh !)
*/
static int __init psurge_quad_probe(void)
{
int type;
unsigned int i;
type = PSURGE_QUAD_IN(PSURGE_QUAD_BOARD_ID);
if (type < PSURGE_QUAD_OKEE || type > PSURGE_QUAD_ICEGRASS
|| type != PSURGE_QUAD_IN(PSURGE_QUAD_BOARD_ID))
return PSURGE_DUAL;
/* looks OK, try a slightly more rigorous test */
/* bogus is not necessarily cacheline-aligned,
though I don't suppose that really matters. -- paulus */
for (i = 0; i < 100; i++) {
volatile u32 bogus[8];
bogus[(0+i)%8] = 0x00000000;
bogus[(1+i)%8] = 0x55555555;
bogus[(2+i)%8] = 0xFFFFFFFF;
bogus[(3+i)%8] = 0xAAAAAAAA;
bogus[(4+i)%8] = 0x33333333;
bogus[(5+i)%8] = 0xCCCCCCCC;
bogus[(6+i)%8] = 0xCCCCCCCC;
bogus[(7+i)%8] = 0x33333333;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/sched.h`, `linux/sched/hotplug.h`, `linux/smp.h`, `linux/interrupt.h`, `linux/irqdomain.h`, `linux/kernel_stat.h`, `linux/delay.h`.
- Detected declarations: `function psurge_set_ipi`, `function psurge_clr_ipi`, `function powersurge`, `function smp_psurge_cause_ipi`, `function psurge_host_map`, `function psurge_secondary_ipi_init`, `function psurge_quad_probe`, `function psurge_quad_init`, `function smp_psurge_probe`, `function smp_psurge_kick_cpu`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.