]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/sys/smp.h
- Include sys/ktr.h so that vnode_if.h can define trace points.
[FreeBSD/FreeBSD.git] / sys / sys / smp.h
1 /*
2  * ----------------------------------------------------------------------------
3  * "THE BEER-WARE LICENSE" (Revision 42):
4  * <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you
5  * can do whatever you want with this stuff. If we meet some day, and you think
6  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
7  * ----------------------------------------------------------------------------
8  *
9  * $FreeBSD$
10  */
11
12 #ifndef _SYS_SMP_H_
13 #define _SYS_SMP_H_
14
15 #ifdef _KERNEL
16
17 #ifndef LOCORE
18
19 #ifdef SMP
20 extern void (*cpustop_restartfunc)(void);
21 extern int mp_ncpus;
22 extern int smp_active;
23 extern volatile int smp_started;
24 extern int smp_cpus;
25 extern u_int all_cpus;
26 extern volatile u_int started_cpus;
27 extern volatile u_int stopped_cpus;
28 extern u_int mp_maxid;
29
30 /*
31  * Macro allowing us to determine whether a CPU is absent at any given
32  * time, thus permitting us to configure sparse maps of cpuid-dependent
33  * (per-CPU) structures.
34  */
35 #define CPU_ABSENT(x_cpu)       ((all_cpus & (1 << (x_cpu))) == 0)
36
37 /*
38  * Machine dependent functions used to initialize MP support.
39  *
40  * The cpu_mp_probe() should check to see if MP support is present and return
41  * zero if it is not or non-zero if it is.  If MP support is present, then
42  * cpu_mp_start() will be called so that MP can be enabled.  This function
43  * should do things such as startup secondary processors.  It should also
44  * setup mp_ncpus, all_cpus, and smp_cpus.  It should also ensure that
45  * smp_active and smp_started are initialized at the appropriate time.
46  * Once cpu_mp_start() returns, machine independent MP startup code will be
47  * executed and a simple message will be output to the console.  Finally,
48  * cpu_mp_announce() will be called so that machine dependent messages about
49  * the MP support may be output to the console if desired.
50  */
51 struct thread;
52
53 void    cpu_mp_announce(void);
54 int     cpu_mp_probe(void);
55 void    cpu_mp_start(void);
56
57 void    forward_signal(struct thread *);
58 void    forward_roundrobin(void);
59 int     restart_cpus(u_int);
60 int     stop_cpus(u_int);
61 void    smp_rendezvous_action(void);
62 void    smp_rendezvous(void (*)(void *), 
63                        void (*)(void *),
64                        void (*)(void *),
65                        void *arg);
66 #else /* SMP */
67 #define CPU_ABSENT(x_cpu)       (0)
68 #endif /* SMP */
69 #endif /* !LOCORE */
70 #endif /* _KERNEL */
71 #endif /* _SYS_SMP_H_ */