Merge from vendor branch GCC:
[dragonfly.git] / sys / platform / pc64 / include / 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: src/sys/amd64/include/smp.h,v 1.90 2007/05/19 05:01:43 kan Exp $
10  * $DragonFly: src/sys/platform/pc64/include/smp.h,v 1.1 2007/09/23 04:42:07 yanyh Exp $
11  *
12  */
13
14 #ifndef _MACHINE_SMP_H_
15 #define _MACHINE_SMP_H_
16
17 #ifdef _KERNEL
18
19 #ifdef SMP
20
21 #ifndef LOCORE
22
23 #include <sys/bus.h>
24 #include <machine/frame.h>
25 #include <machine/intr_machdep.h>
26 #include <machine/apicvar.h>
27 #include <machine/pcb.h>
28
29 /* global symbols in mpboot.S */
30 extern char                     mptramp_start[];
31 extern char                     mptramp_end[];
32 extern u_int32_t                mptramp_pagetables;
33
34 /* global data in mp_machdep.c */
35 extern int                      mp_naps;
36 extern int                      boot_cpu_id;
37 extern struct pcb               stoppcbs[];
38 extern struct mtx               smp_tlb_mtx;
39 extern int                      cpu_apic_ids[];
40
41 /* IPI handlers */
42 inthand_t
43         IDTVEC(invltlb),        /* TLB shootdowns - global */
44         IDTVEC(invlpg),         /* TLB shootdowns - 1 page */
45         IDTVEC(invlrng),        /* TLB shootdowns - page range */
46         IDTVEC(invlcache),      /* Write back and invalidate cache */
47         IDTVEC(ipi_intr_bitmap_handler), /* Bitmap based IPIs */ 
48         IDTVEC(cpustop),        /* CPU stops & waits to be restarted */
49         IDTVEC(rendezvous);     /* handle CPU rendezvous */
50
51 /* functions in mp_machdep.c */
52 void    cpu_add(u_int apic_id, char boot_cpu);
53 void    cpustop_handler(void);
54 void    init_secondary(void);
55 void    ipi_selected(u_int cpus, u_int ipi);
56 void    ipi_all(u_int ipi);
57 void    ipi_all_but_self(u_int ipi);
58 void    ipi_self(u_int ipi);
59 void    ipi_bitmap_handler(struct trapframe frame);
60 u_int   mp_bootaddress(u_int);
61 int     mp_grab_cpu_hlt(void);
62 void    mp_topology(void);
63 void    smp_cache_flush(void);
64 void    smp_invlpg(vm_offset_t addr);
65 void    smp_masked_invlpg(u_int mask, vm_offset_t addr);
66 void    smp_invlpg_range(vm_offset_t startva, vm_offset_t endva);
67 void    smp_masked_invlpg_range(u_int mask, vm_offset_t startva,
68             vm_offset_t endva);
69 void    smp_invltlb(void);
70 void    smp_masked_invltlb(u_int mask);
71
72 #ifdef STOP_NMI
73 int     ipi_nmi_handler(void);
74 #endif
75
76 #endif /* !LOCORE */
77 #else /* !SMP */
78
79 #define smp_active_mask 1       /* smp_active_mask always 1 on UP machines */
80
81 #endif /* !SMP */
82
83 #endif /* _KERNEL */
84 #endif /* _MACHINE_SMP_H_ */