xref: /dragonfly/sys/platform/pc64/include/smp.h (revision 678e8cc6)
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: src/sys/i386/include/smp.h,v 1.50.2.5 2001/02/13 22:32:45 tegge Exp $
10  * $DragonFly: src/sys/platform/pc32/include/smp.h,v 1.20 2006/11/07 06:43:24 dillon Exp $
11  *
12  */
13 
14 #ifndef _MACHINE_SMP_H_
15 #define _MACHINE_SMP_H_
16 
17 #ifdef _KERNEL
18 
19 #ifndef LOCORE
20 
21 /* XXX wrong header */
22 void	initializecpu(void);
23 
24 #endif	/* LOCORE */
25 
26 #if defined(SMP)
27 
28 #ifndef LOCORE
29 
30 /*
31  * For sending values to POST displays.
32  * XXX FIXME: where does this really belong, isa.h/isa.c perhaps?
33  */
34 extern int current_postcode;  /** XXX currently in mp_machdep.c */
35 #define POSTCODE(X)	current_postcode = (X), \
36 			outb(0x80, current_postcode)
37 #define POSTCODE_LO(X)	current_postcode &= 0xf0, \
38 			current_postcode |= ((X) & 0x0f), \
39 			outb(0x80, current_postcode)
40 #define POSTCODE_HI(X)	current_postcode &= 0x0f, \
41 			current_postcode |= (((X) << 4) & 0xf0), \
42 			outb(0x80, current_postcode)
43 
44 
45 #include <machine_base/apic/apicreg.h>
46 #include <machine/pcb.h>
47 
48 /* global symbols in mpboot.S */
49 extern char			mptramp_start[];
50 extern char			mptramp_end[];
51 extern u_int32_t		mptramp_pagetables;
52 
53 /* functions in mpboot.s */
54 void	bootMP			(void);
55 
56 /* global data in apic_vector.s */
57 extern volatile cpumask_t	stopped_cpus;
58 extern volatile cpumask_t	started_cpus;
59 
60 extern volatile u_int		checkstate_probed_cpus;
61 extern void (*cpustop_restartfunc) (void);
62 
63 extern struct pcb		stoppcbs[];
64 
65 /* functions in mp_machdep.c */
66 u_int	mp_bootaddress		(u_int);
67 void	mp_start		(void);
68 void	mp_announce		(void);
69 void	init_secondary		(void);
70 int	stop_cpus		(cpumask_t);
71 void	ap_init			(void);
72 int	restart_cpus		(cpumask_t);
73 void	forward_signal		(struct proc *);
74 
75 #if defined(READY)
76 void	clr_io_apic_mask24	(int, u_int32_t);
77 void	set_io_apic_mask24	(int, u_int32_t);
78 #endif /* READY */
79 
80 void	cpu_send_ipiq		(int);
81 int	cpu_send_ipiq_passive	(int);
82 
83 /* global data in init_smp.c */
84 extern cpumask_t		smp_active_mask;
85 
86 #endif /* !LOCORE */
87 #else	/* !SMP */
88 
89 #define	smp_active_mask	1	/* smp_active_mask always 1 on UP machines */
90 
91 #endif
92 
93 #endif /* _KERNEL */
94 #endif /* _MACHINE_SMP_H_ */
95