Ejemplo n.º 1
0
static int __init smp_core99_probe(void)
{
	struct device_node *cpus;	
	struct device_node *cc;	
	int ncpus = 0;

	/* Maybe use systemconfiguration here ? */
	if (ppc_md.progress) ppc_md.progress("smp_core99_probe", 0x345);

	/* Count CPUs in the device-tree */
       	for (cpus = NULL; (cpus = of_find_node_by_type(cpus, "cpu")) != NULL;)
	       	++ncpus;

	printk(KERN_INFO "PowerMac SMP probe found %d cpus\n", ncpus);

	/* Nothing more to do if less than 2 of them */
	if (ncpus <= 1)
		return 1;

	/* Look for the clock chip */
	for (cc = NULL; (cc = of_find_node_by_name(cc, "i2c-hwclock")) != NULL;) {
		struct device_node *p = of_get_parent(cc);
		u32 *reg;
		int ok;
		ok = p && device_is_compatible(p, "uni-n-i2c");
		if (!ok)
			goto next;
		reg = (u32 *)get_property(cc, "reg", NULL);
		if (reg == NULL)
			goto next;
		switch (*reg) {
		case 0xd2:
			pmac_tb_freeze = smp_core99_cypress_tb_freeze;
			printk(KERN_INFO "Timebase clock is Cypress chip\n");
			break;
		case 0xd4:
			pmac_tb_freeze = smp_core99_pulsar_tb_freeze;
			printk(KERN_INFO "Timebase clock is Pulsar chip\n");
			break;
		}
		if (pmac_tb_freeze != NULL) {
			pmac_tb_clock_chip_host = p;
			smp_ops->give_timebase = smp_core99_give_timebase;
			smp_ops->take_timebase = smp_core99_take_timebase;
			break;
		}
	next:
		of_node_put(p);
	}

	mpic_request_ipis();

	return ncpus;
}
Ejemplo n.º 2
0
int __init smp_mpic_probe(void)
{
	int nr_cpus;

	DBG("smp_mpic_probe()...\n");

	nr_cpus = cpus_weight(cpu_possible_map);

	DBG("nr_cpus: %d\n", nr_cpus);

	if (nr_cpus > 1)
		mpic_request_ipis();

	return nr_cpus;
}