]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/x86/include/x86_smp.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r308421, and update
[FreeBSD/FreeBSD.git] / sys / x86 / include / x86_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
13 #ifndef _X86_X86_SMP_H_
14 #define _X86_X86_SMP_H_
15
16 #include <sys/bus.h>
17 #include <machine/frame.h>
18 #include <machine/intr_machdep.h>
19 #include <x86/apicvar.h>
20 #include <machine/pcb.h>
21
22 struct pmap;
23
24 /* global data in mp_x86.c */
25 extern int mp_naps;
26 extern int boot_cpu_id;
27 extern struct pcb stoppcbs[];
28 extern int cpu_apic_ids[];
29 extern int bootAP;
30 extern void *dpcpu;
31 extern char *bootSTK;
32 extern void *bootstacks[];
33 extern volatile u_int cpu_ipi_pending[];
34 extern volatile int aps_ready;
35 extern struct mtx ap_boot_mtx;
36 extern int cpu_logical;
37 extern int cpu_cores;
38 extern volatile uint32_t smp_tlb_generation;
39 extern struct pmap *smp_tlb_pmap;
40 extern u_int xhits_gbl[];
41 extern u_int xhits_pg[];
42 extern u_int xhits_rng[];
43 extern u_int ipi_global;
44 extern u_int ipi_page;
45 extern u_int ipi_range;
46 extern u_int ipi_range_size;
47
48 extern int nmi_kdb_lock;
49 extern int nmi_is_broadcast;
50
51 struct cpu_info {
52         int     cpu_present:1;
53         int     cpu_bsp:1;
54         int     cpu_disabled:1;
55         int     cpu_hyperthread:1;
56 };
57 extern struct cpu_info cpu_info[];
58
59 #ifdef COUNT_IPIS
60 extern u_long *ipi_invltlb_counts[MAXCPU];
61 extern u_long *ipi_invlrng_counts[MAXCPU];
62 extern u_long *ipi_invlpg_counts[MAXCPU];
63 extern u_long *ipi_invlcache_counts[MAXCPU];
64 extern u_long *ipi_rendezvous_counts[MAXCPU];
65 #endif
66
67 /* IPI handlers */
68 inthand_t
69         IDTVEC(invltlb),        /* TLB shootdowns - global */
70         IDTVEC(invlpg),         /* TLB shootdowns - 1 page */
71         IDTVEC(invlrng),        /* TLB shootdowns - page range */
72         IDTVEC(invlcache),      /* Write back and invalidate cache */
73         IDTVEC(ipi_intr_bitmap_handler), /* Bitmap based IPIs */ 
74         IDTVEC(cpustop),        /* CPU stops & waits to be restarted */
75         IDTVEC(cpususpend),     /* CPU suspends & waits to be resumed */
76         IDTVEC(rendezvous);     /* handle CPU rendezvous */
77
78 /* functions in x86_mp.c */
79 void    assign_cpu_ids(void);
80 void    cpu_add(u_int apic_id, char boot_cpu);
81 void    cpustop_handler(void);
82 void    cpususpend_handler(void);
83 void    init_secondary_tail(void);
84 void    invltlb_handler(void);
85 void    invlpg_handler(void);
86 void    invlrng_handler(void);
87 void    invlcache_handler(void);
88 void    init_secondary(void);
89 void    ipi_startup(int apic_id, int vector);
90 void    ipi_all_but_self(u_int ipi);
91 void    ipi_bitmap_handler(struct trapframe frame);
92 void    ipi_cpu(int cpu, u_int ipi);
93 int     ipi_nmi_handler(void);
94 void    ipi_selected(cpuset_t cpus, u_int ipi);
95 u_int   mp_bootaddress(u_int);
96 void    set_interrupt_apic_ids(void);
97 void    smp_cache_flush(void);
98 void    smp_masked_invlpg(cpuset_t mask, vm_offset_t addr);
99 void    smp_masked_invlpg_range(cpuset_t mask, vm_offset_t startva,
100             vm_offset_t endva);
101 void    smp_masked_invltlb(cpuset_t mask, struct pmap *pmap);
102 void    mem_range_AP_init(void);
103 void    topo_probe(void);
104 void    ipi_send_cpu(int cpu, u_int ipi);
105
106 #endif