Lines Matching +full:cpu +full:- +full:nr
1 // SPDX-License-Identifier: GPL-2.0-or-later
12 * code to detect this card though and disable SMP. --BenH.
17 * Support for DayStar quad CPU cards
18 * Copyright (C) XLR8, Inc. 1994-2000
32 #include <linux/cpu.h>
38 #include <asm/text-patching.h>
89 /* Daystar/XLR8 4-CPU card */
115 #define PSURGE_NONE -1
131 static inline void psurge_set_ipi(int cpu) in psurge_set_ipi() argument
135 if (cpu == 0) in psurge_set_ipi()
140 PSURGE_QUAD_OUT(PSURGE_QUAD_IRQ_SET, 1 << cpu); in psurge_set_ipi()
143 static inline void psurge_clr_ipi(int cpu) in psurge_clr_ipi() argument
145 if (cpu > 0) { in psurge_clr_ipi()
153 PSURGE_QUAD_OUT(PSURGE_QUAD_IRQ_CLR, 1 << cpu); in psurge_clr_ipi()
162 * -- paulus.
172 static void smp_psurge_cause_ipi(int cpu) in smp_psurge_cause_ipi() argument
174 psurge_set_ipi(cpu); in smp_psurge_cause_ipi()
191 int rc = -ENOMEM; in psurge_secondary_ipi_init()
203 pr_err("Failed to setup secondary cpu IPI\n"); in psurge_secondary_ipi_init()
224 /* bogus is not necessarily cacheline-aligned, in psurge_quad_probe()
225 though I don't suppose that really matters. -- paulus */ in psurge_quad_probe()
275 * The powersurge cpu board can be used in the generation in smp_psurge_probe()
276 * of powermacs that have a socket for an upgradeable cpu card, in smp_psurge_probe()
282 * dual-cpu powersurge board. -- paulus. in smp_psurge_probe()
299 smp_ops->give_timebase = smp_generic_give_timebase; in smp_psurge_probe()
300 smp_ops->take_timebase = smp_generic_take_timebase; in smp_psurge_probe()
304 /* not a dual-cpu card */ in smp_psurge_probe()
319 * secondary cpu(s), and thus there aren't nodes in the in smp_psurge_probe()
328 if (ppc_md.progress) ppc_md.progress("smp_psurge_probe - done", 0x352); in smp_psurge_probe()
331 static int __init smp_psurge_kick_cpu(int nr) in smp_psurge_kick_cpu() argument
333 unsigned long start = __pa(__secondary_start_pmac_0) + nr * 8; in smp_psurge_kick_cpu()
356 psurge_set_ipi(nr); in smp_psurge_kick_cpu()
363 psurge_clr_ipi(nr); in smp_psurge_kick_cpu()
367 * caller which will try to do udelay's etc... Instead, we wait -here- in smp_psurge_kick_cpu()
368 * for the CPU to callin. in smp_psurge_kick_cpu()
370 for (i = 0; i < 100000 && !cpu_callin_map[nr]; ++i) { in smp_psurge_kick_cpu()
375 if (!cpu_callin_map[nr]) in smp_psurge_kick_cpu()
378 /* And we do the TB sync here too for standard dual CPU cards */ in smp_psurge_kick_cpu()
395 if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu - done", 0x354); in smp_psurge_kick_cpu()
437 /* PowerSurge-style Macs */
498 * G5s enable/disable the timebase via an i2c-connected clock chip.
508 /* Strangely, the device-tree says address is 0xd2, but darwin in smp_core99_cypress_tb_freeze()
571 for_each_node_by_name(cc, "i2c-hwclock") { in smp_core99_setup_i2c_hwsync()
573 ok = p && of_device_is_compatible(p, "uni-n-i2c"); in smp_core99_setup_i2c_hwsync()
586 if (of_device_is_compatible(cc,"pulsar-legacy-slewing")) { in smp_core99_setup_i2c_hwsync()
637 pmf_call_function(cpus, "cpu-timebase", &args); in smp_core99_pfunc_tb_freeze()
661 static void core99_init_caches(int cpu) in core99_init_caches() argument
671 if (cpu == 0) { in core99_init_caches()
675 printk("CPU%d: L2CR was %lx\n", cpu, _get_L2CR()); in core99_init_caches()
678 printk("CPU%d: L2CR set to %lx\n", cpu, core99_l2_cache); in core99_init_caches()
684 if (cpu == 0){ in core99_init_caches()
688 printk("CPU%d: L3CR was %lx\n", cpu, _get_L3CR()); in core99_init_caches()
691 printk("CPU%d: L3CR set to %lx\n", cpu, core99_l3_cache); in core99_init_caches()
711 of_property_read_bool(cpus, "platform-cpu-timebase")) { in smp_core99_setup()
723 struct device_node *cpu; in smp_core99_setup()
727 cpu = of_find_node_by_type(NULL, "cpu"); in smp_core99_setup()
728 if (cpu != NULL) { in smp_core99_setup()
729 tbprop = of_get_property(cpu, "timebase-enable", NULL); in smp_core99_setup()
732 of_node_put(cpu); in smp_core99_setup()
743 smp_ops->give_timebase = smp_generic_give_timebase; in smp_core99_setup()
744 smp_ops->take_timebase = smp_generic_take_timebase; in smp_core99_setup()
770 /* Count CPUs in the device-tree */ in smp_core99_probe()
771 for_each_node_by_type(cpus, "cpu") in smp_core99_probe()
792 /* Collect l2cr and l3cr values from CPU 0 */ in smp_core99_probe()
796 static int smp_core99_kick_cpu(int nr) in smp_core99_kick_cpu() argument
802 if (nr < 0 || nr > 3) in smp_core99_kick_cpu()
803 return -ENOENT; in smp_core99_kick_cpu()
814 * b __secondary_start_pmac_0 + nr*8 in smp_core99_kick_cpu()
816 target = (unsigned long) __secondary_start_pmac_0 + nr * 8; in smp_core99_kick_cpu()
820 pmac_call_feature(PMAC_FTR_RESET_CPU, NULL, nr, 0); in smp_core99_kick_cpu()
822 /* FIXME: We wait a bit for the CPU to take the exception, I should in smp_core99_kick_cpu()
824 * ideally, all that crap will be done in prom.c and the CPU left in smp_core99_kick_cpu()
825 * in a RAM-based wait loop like CHRP. in smp_core99_kick_cpu()
852 static int smp_core99_cpu_prepare(unsigned int cpu) in smp_core99_cpu_prepare() argument
868 static int smp_core99_cpu_online(unsigned int cpu) in smp_core99_cpu_online() argument
885 /* If we didn't start the second CPU, we must take in smp_core99_bringup_done()
925 int cpu = smp_processor_id(); in pmac_cpu_offline_self() local
929 pr_debug("CPU%d offline\n", cpu); in pmac_cpu_offline_self()
930 generic_set_cpu_dead(cpu); in pmac_cpu_offline_self()
940 int cpu = smp_processor_id(); in pmac_cpu_offline_self() local
951 printk(KERN_INFO "CPU#%d offline\n", cpu); in pmac_cpu_offline_self()
952 generic_set_cpu_dead(cpu); in pmac_cpu_offline_self()
956 * Re-enable interrupts. The NAP code needs to enable them in pmac_cpu_offline_self()
958 * happened while soft-disabled. in pmac_cpu_offline_self()
998 np = of_find_node_by_name(NULL, "uni-n"); in pmac_setup_smp()
1010 * secondary CPU(s) aren't in the device tree. Various in pmac_setup_smp()
1014 int cpu; in pmac_setup_smp() local
1016 for (cpu = 1; cpu < 4 && cpu < NR_CPUS; ++cpu) in pmac_setup_smp()
1017 set_cpu_possible(cpu, true); in pmac_setup_smp()
1023 smp_ops->cpu_offline_self = pmac_cpu_offline_self; in pmac_setup_smp()