1139731Simp/*-
225164Speter * ----------------------------------------------------------------------------
325164Speter * "THE BEER-WARE LICENSE" (Revision 42):
425164Speter * <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you
525164Speter * can do whatever you want with this stuff. If we meet some day, and you think
625164Speter * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
725164Speter * ----------------------------------------------------------------------------
825164Speter *
950477Speter * $FreeBSD$
1025164Speter *
1125164Speter */
1225164Speter
1325164Speter#ifndef _MACHINE_SMP_H_
1425164Speter#define _MACHINE_SMP_H_
1525164Speter
16122849Speter#ifdef _KERNEL
17122849Speter
18122849Speter#ifdef SMP
19122849Speter
20122849Speter#ifndef LOCORE
21122849Speter
22122849Speter#include <sys/bus.h>
23122849Speter#include <machine/frame.h>
24122849Speter#include <machine/intr_machdep.h>
25122849Speter#include <machine/apicvar.h>
26169730Skan#include <machine/pcb.h>
27122849Speter
28122849Speter/* global symbols in mpboot.S */
29122849Speterextern char			mptramp_start[];
30122849Speterextern char			mptramp_end[];
31122849Speterextern u_int32_t		mptramp_pagetables;
32122849Speter
33122849Speter/* global data in mp_machdep.c */
34122849Speterextern int			mp_naps;
35122849Speterextern int			boot_cpu_id;
36122849Speterextern struct pcb		stoppcbs[];
37167273Sjhbextern int			cpu_apic_ids[];
38209248Smav#ifdef COUNT_IPIS
39209248Smavextern u_long *ipi_invltlb_counts[MAXCPU];
40209248Smavextern u_long *ipi_invlrng_counts[MAXCPU];
41209248Smavextern u_long *ipi_invlpg_counts[MAXCPU];
42209248Smavextern u_long *ipi_invlcache_counts[MAXCPU];
43209248Smavextern u_long *ipi_rendezvous_counts[MAXCPU];
44209248Smav#endif
45122849Speter
46122849Speter/* IPI handlers */
47122849Speterinthand_t
48255217Skib	IDTVEC(invltlb_pcid),	/* TLB shootdowns - global, pcid enabled */
49122849Speter	IDTVEC(invltlb),	/* TLB shootdowns - global */
50255217Skib	IDTVEC(invlpg_pcid),	/* TLB shootdowns - 1 page, pcid enabled */
51122849Speter	IDTVEC(invlpg),		/* TLB shootdowns - 1 page */
52122849Speter	IDTVEC(invlrng),	/* TLB shootdowns - page range */
53158236Sjhb	IDTVEC(invlcache),	/* Write back and invalidate cache */
54140555Speter	IDTVEC(ipi_intr_bitmap_handler), /* Bitmap based IPIs */
55122849Speter	IDTVEC(cpustop),	/* CPU stops & waits to be restarted */
56189903Sjkim	IDTVEC(cpususpend),	/* CPU suspends & waits to be resumed */
57129305Speter	IDTVEC(rendezvous);	/* handle CPU rendezvous */
58122849Speter
59255060Skibstruct pmap;
60255060Skib
61122849Speter/* functions in mp_machdep.c */
62122849Spetervoid	cpu_add(u_int apic_id, char boot_cpu);
63153241Sjhbvoid	cpustop_handler(void);
64189903Sjkimvoid	cpususpend_handler(void);
65264118Sroygervoid	invltlb_handler(void);
66264118Sroygervoid	invltlb_pcid_handler(void);
67264118Sroygervoid	invlpg_handler(void);
68264118Sroygervoid	invlpg_pcid_handler(void);
69264118Sroygervoid	invlrng_handler(void);
70264118Sroygervoid	invlcache_handler(void);
71122849Spetervoid	init_secondary(void);
72236938Siwasakivoid	ipi_startup(int apic_id, int vector);
73210939Sjhbvoid	ipi_all_but_self(u_int ipi);
74210939Sjhbvoid 	ipi_bitmap_handler(struct trapframe frame);
75210939Sjhbvoid	ipi_cpu(int cpu, u_int ipi);
76196196Sattilioint	ipi_nmi_handler(void);
77222813Sattiliovoid	ipi_selected(cpuset_t cpus, u_int ipi);
78122849Speteru_int	mp_bootaddress(u_int);
79158236Sjhbvoid	smp_cache_flush(void);
80255060Skibvoid	smp_invlpg(struct pmap *pmap, vm_offset_t addr);
81255060Skibvoid	smp_masked_invlpg(cpuset_t mask, struct pmap *pmap, vm_offset_t addr);
82255060Skibvoid	smp_invlpg_range(struct pmap *pmap, vm_offset_t startva,
83122849Speter	    vm_offset_t endva);
84255060Skibvoid	smp_masked_invlpg_range(cpuset_t mask, struct pmap *pmap,
85255060Skib	    vm_offset_t startva, vm_offset_t endva);
86255060Skibvoid	smp_invltlb(struct pmap *pmap);
87255060Skibvoid	smp_masked_invltlb(cpuset_t mask, struct pmap *pmap);
88122849Speter
89122849Speter#endif /* !LOCORE */
90122849Speter#endif /* SMP */
91122849Speter
92122849Speter#endif /* _KERNEL */
9325164Speter#endif /* _MACHINE_SMP_H_ */
94