smp.h revision 121996
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: head/sys/i386/include/smp.h 121996 2003-11-03 22:32:04Z jhb $
10 *
11 */
12
13#ifndef _MACHINE_SMP_H_
14#define _MACHINE_SMP_H_
15
16#ifdef _KERNEL
17
18#ifdef SMP
19
20#ifndef LOCORE
21
22/*
23 * For sending values to POST displays.
24 * XXX FIXME: where does this really belong, isa.h/isa.c perhaps?
25 */
26extern int current_postcode;  /** XXX currently in mp_machdep.c */
27#define POSTCODE(X)	current_postcode = (X), \
28			outb(0x80, current_postcode)
29#define POSTCODE_LO(X)	current_postcode &= 0xf0, \
30			current_postcode |= ((X) & 0x0f), \
31			outb(0x80, current_postcode)
32#define POSTCODE_HI(X)	current_postcode &= 0x0f, \
33			current_postcode |= (((X) << 4) & 0xf0), \
34			outb(0x80, current_postcode)
35
36#include <sys/bus.h>
37#include <machine/frame.h>
38#include <machine/intr_machdep.h>
39#include <machine/apicvar.h>
40
41/* global data in mpboot.s */
42extern int			bootMP_size;
43
44/* functions in mpboot.s */
45void	bootMP(void);
46
47/* global data in mp_machdep.c */
48extern int			mp_naps;
49extern int			boot_cpu_id;
50extern struct pcb		stoppcbs[];
51extern struct mtx		smp_tlb_mtx;
52
53/* IPI handlers */
54inthand_t
55	IDTVEC(invltlb),	/* TLB shootdowns - global */
56	IDTVEC(invlpg),		/* TLB shootdowns - 1 page */
57	IDTVEC(invlrng),	/* TLB shootdowns - page range */
58	IDTVEC(hardclock),	/* Forward hardclock() */
59	IDTVEC(statclock),	/* Forward statclock() */
60	IDTVEC(cpuast),		/* Additional software trap on other cpu */
61	IDTVEC(cpustop),	/* CPU stops & waits to be restarted */
62	IDTVEC(rendezvous),	/* handle CPU rendezvous */
63	IDTVEC(lazypmap);	/* handle lazy pmap release */
64
65/* functions in mp_machdep.c */
66void	cpu_add(u_int apic_id, char boot_cpu);
67void	init_secondary(void);
68void	ipi_selected(u_int cpus, u_int ipi);
69void	ipi_all(u_int ipi);
70void	ipi_all_but_self(u_int ipi);
71void	ipi_self(u_int ipi);
72void	forward_statclock(void);
73void	forwarded_statclock(struct clockframe frame);
74void	forward_hardclock(void);
75void	forwarded_hardclock(struct clockframe frame);
76u_int	mp_bootaddress(u_int);
77int	mp_grab_cpu_hlt(void);
78void	smp_invlpg(vm_offset_t addr);
79void	smp_masked_invlpg(u_int mask, vm_offset_t addr);
80void	smp_invlpg_range(vm_offset_t startva, vm_offset_t endva);
81void	smp_masked_invlpg_range(u_int mask, vm_offset_t startva,
82	    vm_offset_t endva);
83void	smp_invltlb(void);
84void	smp_masked_invltlb(u_int mask);
85
86#endif /* !LOCORE */
87#endif /* SMP */
88
89#endif /* _KERNEL */
90#endif /* _MACHINE_SMP_H_ */
91