LAUNCH on SGI Origin 350

プロセッサの検出はKLCONFIGで出来る事が分かったが、起動はどうしているのだろうか。
Linuxでは、arch/mips/sgi-ip27/ip27-smp.cにこんな事が書いてある:

static void __cpuinit ip27_boot_secondary(int cpu, struct task_struct *idle)
{
	unsigned long gp = (unsigned long)task_thread_info(idle);
	unsigned long sp = __KSTK_TOS(idle);

	LAUNCH_SLAVE(cputonasid(cpu), cputoslice(cpu),
		(launch_proc_t)MAPPED_KERN_RW_TO_K0(smp_bootstrap),
		0, (void *) sp, (void *) gp);
}

LAUNCH_SLAVEマクロはarch/mips/include/asm/sn/launch.hに入ってる:

/*
 * PROM entry points for launch routines are determined by IPxxprom/start.s
 */

#define LAUNCH_SLAVE	(*(void (*)(int nasid, int cpu, \
				    launch_proc_t call_addr, \
				    u64 call_parm, \
				    void *stack_addr, \
				    void *gp_addr)) \
			 IP27PROM_LAUNCHSLAVE)

要するに、PROMの関数をそのまま叩いている訳だ。
叩くと何が起きるのかについてもコメントが書かれていて、

/*
 * The launch data structure resides at a fixed place in each node's memory
 * and is used to communicate between the master processor and the slave
 * processors.
 *
 * The master stores launch parameters in the launch structure
 * corresponding to a target processor that is in a slave loop, then sends
 * an interrupt to the slave processor.  The slave calls the desired
 * function, then returns to the slave loop.  The master may poll or wait
 * for the slaves to finish.
 *
 * There is an array of launch structures, one per CPU on the node.  One
 * interrupt level is used per local CPU.
 */

パラメータをメモリ上にある構造体に突っ込んでからスレーブがループしているのを割り込みで起こし、起こされた側は構造体をチェックして指定アドレスへジャンプする、という仕掛けっぽい。
これはソフト的な実装なのね。

この部分はOpenBSD/sgiに無いので持ってくる必要がある。

所で、このコードはIP27向けでOrigin 350はIP35なんだけど、PROMのアドレスは違わないのかな?という点が若干疑問なんだけれども、Miodに聞いたら「多分同じっぽ」って言ってるので大丈夫かな。