smp.h revision 176734
1177633Sdfr/*-
2177633Sdfr * ----------------------------------------------------------------------------
3258578Shrs * "THE BEER-WARE LICENSE" (Revision 42):
4258578Shrs * <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you
5258578Shrs * can do whatever you want with this stuff. If we meet some day, and you think
6258578Shrs * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
7258578Shrs * ----------------------------------------------------------------------------
8258578Shrs *
9258578Shrs * $FreeBSD: head/sys/amd64/include/smp.h 176734 2008-03-02 07:58:42Z jeff $
10258578Shrs *
11258578Shrs */
12258578Shrs
13258578Shrs#ifndef _MACHINE_SMP_H_
14258578Shrs#define _MACHINE_SMP_H_
15258578Shrs
16258578Shrs#ifdef _KERNEL
17177633Sdfr
18258578Shrs#ifdef SMP
19258578Shrs
20258578Shrs#ifndef LOCORE
21258578Shrs
22258578Shrs#include <sys/bus.h>
23258578Shrs#include <machine/frame.h>
24258578Shrs#include <machine/intr_machdep.h>
25258578Shrs#include <machine/apicvar.h>
26258578Shrs#include <machine/pcb.h>
27258578Shrs
28258578Shrs/* global symbols in mpboot.S */
29177633Sdfrextern char			mptramp_start[];
30177633Sdfrextern char			mptramp_end[];
31177633Sdfrextern u_int32_t		mptramp_pagetables;
32177633Sdfr
33177633Sdfr/* global data in mp_machdep.c */
34177633Sdfrextern int			mp_naps;
35177633Sdfrextern int			boot_cpu_id;
36177633Sdfrextern struct pcb		stoppcbs[];
37177633Sdfrextern int			cpu_apic_ids[];
38177633Sdfr
39177633Sdfr/* global data in identcpu.c */
40177633Sdfrextern int			cpu_cores;
41177633Sdfrextern int			cpu_logical;
42177633Sdfr
43177633Sdfr/* IPI handlers */
44177633Sdfrinthand_t
45177633Sdfr	IDTVEC(invltlb),	/* TLB shootdowns - global */
46177633Sdfr	IDTVEC(invlpg),		/* TLB shootdowns - 1 page */
47177633Sdfr	IDTVEC(invlrng),	/* TLB shootdowns - page range */
48177633Sdfr	IDTVEC(invlcache),	/* Write back and invalidate cache */
49177633Sdfr	IDTVEC(ipi_intr_bitmap_handler), /* Bitmap based IPIs */
50177633Sdfr	IDTVEC(cpustop),	/* CPU stops & waits to be restarted */
51177633Sdfr	IDTVEC(rendezvous);	/* handle CPU rendezvous */
52177633Sdfr
53177633Sdfr/* functions in mp_machdep.c */
54177633Sdfrvoid	cpu_add(u_int apic_id, char boot_cpu);
55184588Sdfrvoid	cpustop_handler(void);
56177633Sdfrvoid	init_secondary(void);
57177633Sdfrvoid	ipi_selected(u_int cpus, u_int ipi);
58177633Sdfrvoid	ipi_all(u_int ipi);
59196503Szecvoid	ipi_all_but_self(u_int ipi);
60196503Szecvoid	ipi_self(u_int ipi);
61177633Sdfrvoid 	ipi_bitmap_handler(struct trapframe frame);
62177633Sdfru_int	mp_bootaddress(u_int);
63177685Sdfrint	mp_grab_cpu_hlt(void);
64177633Sdfrvoid	smp_cache_flush(void);
65177633Sdfrvoid	smp_invlpg(vm_offset_t addr);
66184588Sdfrvoid	smp_masked_invlpg(u_int mask, vm_offset_t addr);
67184588Sdfrvoid	smp_invlpg_range(vm_offset_t startva, vm_offset_t endva);
68184588Sdfrvoid	smp_masked_invlpg_range(u_int mask, vm_offset_t startva,
69184588Sdfr	    vm_offset_t endva);
70177633Sdfrvoid	smp_invltlb(void);
71177633Sdfrvoid	smp_masked_invltlb(u_int mask);
72193272Sjhb
73177633Sdfr#ifdef STOP_NMI
74177633Sdfrint	ipi_nmi_handler(void);
75177633Sdfr#endif
76177633Sdfr
77177633Sdfr#endif /* !LOCORE */
78177633Sdfr#endif /* SMP */
79177633Sdfr
80177633Sdfr#endif /* _KERNEL */
81177633Sdfr#endif /* _MACHINE_SMP_H_ */
82177633Sdfr