smp.h revision 91673
125164Speter/* 225164Speter * ---------------------------------------------------------------------------- 325164Speter * "THE BEER-WARE LICENSE" (Revision 42): 425164Speter * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you 525164Speter * can do whatever you want with this stuff. If we meet some day, and you think 625164Speter * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 725164Speter * ---------------------------------------------------------------------------- 825164Speter * 950477Speter * $FreeBSD: head/sys/sys/smp.h 91673 2002-03-05 10:01:46Z jeff $ 1025164Speter */ 1125164Speter 1276078Sjhb#ifndef _SYS_SMP_H_ 1376078Sjhb#define _SYS_SMP_H_ 1425164Speter 1555205Speter#ifdef _KERNEL 1676078Sjhb#include <machine/smp.h> 1725164Speter 1876078Sjhb#ifndef LOCORE 1925517Sfsmp 2076078Sjhb#ifdef SMP 2176078Sjhbextern void (*cpustop_restartfunc)(void); 2276078Sjhbextern int mp_ncpus; 2376078Sjhbextern int smp_active; 2485765Smarcelextern volatile int smp_started; 2576078Sjhbextern int smp_cpus; 2676078Sjhbextern u_int all_cpus; 2776078Sjhbextern volatile u_int started_cpus; 2876078Sjhbextern volatile u_int stopped_cpus; 2991673Sjeffextern u_int mp_maxid; 3027728Sfsmp 3127002Sfsmp/* 3280779Sbmilekic * Macro allowing us to determine whether a CPU is absent at any given 3380779Sbmilekic * time, thus permitting us to configure sparse maps of cpuid-dependent 3480779Sbmilekic * (per-CPU) structures. 3580779Sbmilekic */ 3680779Sbmilekic#define CPU_ABSENT(x_cpu) ((all_cpus & (1 << (x_cpu))) == 0) 3780779Sbmilekic 3880779Sbmilekic/* 3976078Sjhb * Machine dependent functions used to initialize MP support. 4076078Sjhb * 4176078Sjhb * The cpu_mp_probe() should check to see if MP support is present and return 4276078Sjhb * zero if it is not or non-zero if it is. If MP support is present, then 4376078Sjhb * cpu_mp_start() will be called so that MP can be enabled. This function 4476078Sjhb * should do things such as startup secondary processors. It should also 4576078Sjhb * setup mp_ncpus, all_cpus, and smp_cpus. It should also ensure that 4676078Sjhb * smp_active and smp_started are initialized at the appropriate time. 4776078Sjhb * Once cpu_mp_start() returns, machine independent MP startup code will be 4876078Sjhb * executed and a simple message will be output to the console. Finally, 4976078Sjhb * cpu_mp_announce() will be called so that machine dependent messages about 5076078Sjhb * the MP support may be output to the console if desired. 5127002Sfsmp */ 5276078Sjhbvoid cpu_mp_announce(void); 5376078Sjhbint cpu_mp_probe(void); 5476078Sjhbvoid cpu_mp_start(void); 5527002Sfsmp 5683366Sjulianvoid forward_signal(struct thread *); 5776078Sjhbvoid forward_roundrobin(void); 5876078Sjhbint restart_cpus(u_int); 5976078Sjhbint stop_cpus(u_int); 6076078Sjhbvoid smp_rendezvous_action(void); 6176078Sjhbvoid smp_rendezvous(void (*)(void *), 6276078Sjhb void (*)(void *), 6376078Sjhb void (*)(void *), 6476078Sjhb void *arg); 6580779Sbmilekic#else /* SMP */ 6680779Sbmilekic#define CPU_ABSENT(x_cpu) (0) 6776078Sjhb#endif /* SMP */ 6827728Sfsmp#endif /* !LOCORE */ 6955205Speter#endif /* _KERNEL */ 7076078Sjhb#endif /* _SYS_SMP_H_ */ 71