smp.h revision 158236
1189251Ssam/*-
2189251Ssam * ----------------------------------------------------------------------------
3189251Ssam * "THE BEER-WARE LICENSE" (Revision 42):
4189251Ssam * <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you
5189251Ssam * can do whatever you want with this stuff. If we meet some day, and you think
6189251Ssam * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
7189251Ssam * ----------------------------------------------------------------------------
8189251Ssam *
9189251Ssam * $FreeBSD: head/sys/amd64/include/smp.h 158236 2006-05-01 21:36:47Z jhb $
10189251Ssam *
11189251Ssam */
12189251Ssam
13189251Ssam#ifndef _MACHINE_SMP_H_
14189251Ssam#define _MACHINE_SMP_H_
15189251Ssam
16189251Ssam#ifdef _KERNEL
17189251Ssam
18189251Ssam#ifdef SMP
19189251Ssam
20189251Ssam#ifndef LOCORE
21189251Ssam
22189251Ssam#include <sys/bus.h>
23189251Ssam#include <machine/frame.h>
24189251Ssam#include <machine/intr_machdep.h>
25189251Ssam#include <machine/apicvar.h>
26189251Ssam
27189251Ssam/* global symbols in mpboot.S */
28189251Ssamextern char			mptramp_start[];
29189251Ssamextern char			mptramp_end[];
30189251Ssamextern u_int32_t		mptramp_pagetables;
31189251Ssam
32189251Ssam/* global data in mp_machdep.c */
33189251Ssamextern int			mp_naps;
34189251Ssamextern int			boot_cpu_id;
35189251Ssamextern struct pcb		stoppcbs[];
36189251Ssamextern struct mtx		smp_tlb_mtx;
37189251Ssam
38189251Ssam/* IPI handlers */
39inthand_t
40	IDTVEC(invltlb),	/* TLB shootdowns - global */
41	IDTVEC(invlpg),		/* TLB shootdowns - 1 page */
42	IDTVEC(invlrng),	/* TLB shootdowns - page range */
43	IDTVEC(invlcache),	/* Write back and invalidate cache */
44	IDTVEC(ipi_intr_bitmap_handler), /* Bitmap based IPIs */
45	IDTVEC(cpustop),	/* CPU stops & waits to be restarted */
46	IDTVEC(rendezvous);	/* handle CPU rendezvous */
47
48/* functions in mp_machdep.c */
49void	cpu_add(u_int apic_id, char boot_cpu);
50void	cpustop_handler(void);
51void	init_secondary(void);
52void	ipi_selected(u_int cpus, u_int ipi);
53void	ipi_all(u_int ipi);
54void	ipi_all_but_self(u_int ipi);
55void	ipi_self(u_int ipi);
56void 	ipi_bitmap_handler(struct trapframe frame);
57u_int	mp_bootaddress(u_int);
58int	mp_grab_cpu_hlt(void);
59void	mp_topology(void);
60void	smp_cache_flush(void);
61void	smp_invlpg(vm_offset_t addr);
62void	smp_masked_invlpg(u_int mask, vm_offset_t addr);
63void	smp_invlpg_range(vm_offset_t startva, vm_offset_t endva);
64void	smp_masked_invlpg_range(u_int mask, vm_offset_t startva,
65	    vm_offset_t endva);
66void	smp_invltlb(void);
67void	smp_masked_invltlb(u_int mask);
68
69#ifdef STOP_NMI
70int	ipi_nmi_handler(void);
71#endif
72
73#endif /* !LOCORE */
74#endif /* SMP */
75
76#endif /* _KERNEL */
77#endif /* _MACHINE_SMP_H_ */
78