arch/mips/sgi-ip27/ip27-smp.c

Source file repositories/reference/linux-study-clean/arch/mips/sgi-ip27/ip27-smp.c

File Facts

System
Linux kernel
Corpus path
arch/mips/sgi-ip27/ip27-smp.c
Extension
.c
Size
4451 bytes
Lines
192
Domain
Architecture Layer
Bucket
arch/mips
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.

Dependency Surface

Detected Declarations

Annotated Snippet

while (acpu) {
			cpuid = acpu->cpu_info.virtid;
			/* Only let it join in if it's marked enabled */
			if ((acpu->cpu_info.flags & KLINFO_ENABLE) &&
			    (cpus_found != NR_CPUS)) {
				if (cpuid > highest)
					highest = cpuid;
				set_cpu_possible(cpuid, true);
				cputonasid(cpus_found) = nasid;
				cputoslice(cpus_found) = acpu->cpu_info.physid;
				sn_cpu_info[cpus_found].p_speed =
							acpu->cpu_speed;
				cpus_found++;
			}
			acpu = (klcpu_t *)find_component(brd, (klinfo_t *)acpu,
								KLSTRUCT_CPU);
		}
		brd = KLCF_NEXT(brd);
		if (!brd)
			break;

		brd = find_lboard(brd, KLTYPE_IP27);
	} while (brd);

	return highest;
}

void cpu_node_probe(void)
{
	int i, highest = 0;
	gda_t *gdap = GDA;

	nodes_clear(node_online_map);
	nodes_clear(node_possible_map);
	for (i = 0; i < MAX_NUMNODES; i++) {
		nasid_t nasid = gdap->g_nasidtable[i];
		if (nasid == INVALID_NASID)
			break;
		node_set_online(nasid);
		node_set(nasid, node_possible_map);
		highest = node_scan_cpus(nasid, highest);
	}

	printk("Discovered %d cpus on %d nodes\n", highest + 1, num_online_nodes());
}

static __init void intr_clear_all(nasid_t nasid)
{
	int i;

	REMOTE_HUB_S(nasid, PI_INT_MASK0_A, 0);
	REMOTE_HUB_S(nasid, PI_INT_MASK0_B, 0);
	REMOTE_HUB_S(nasid, PI_INT_MASK1_A, 0);
	REMOTE_HUB_S(nasid, PI_INT_MASK1_B, 0);

	for (i = 0; i < 128; i++)
		REMOTE_HUB_CLR_INTR(nasid, i);
}

static void ip27_send_ipi_single(int destid, unsigned int action)
{
	int irq;

	switch (action) {
	case SMP_RESCHEDULE_YOURSELF:
		irq = CPU_RESCHED_A_IRQ;
		break;
	case SMP_CALL_FUNCTION:
		irq = CPU_CALL_A_IRQ;
		break;
	default:
		panic("sendintr");
	}

	irq += cputoslice(destid);

	/*
	 * Set the interrupt bit associated with the CPU we want to
	 * send the interrupt to.
	 */
	REMOTE_HUB_SEND_INTR(cpu_to_node(destid), irq);
}

static void ip27_send_ipi_mask(const struct cpumask *mask, unsigned int action)
{
	unsigned int i;

	for_each_cpu(i, mask)
		ip27_send_ipi_single(i, action);
}

Annotation

Implementation Notes