smp.h revision 26948
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 * $Id: smp.h,v 1.3 1997/06/25 20:43:48 smp Exp smp $
10 *
11 */
12
13#ifndef _MACHINE_SMP_H_
14#define _MACHINE_SMP_H_
15
16#ifdef KERNEL
17
18#if defined(SMP) && !defined(APIC_IO)
19# error APIC_IO required for SMP, add "options APIC_IO" to your config file.
20#endif /* SMP && NCPU */
21
22#if defined(SMP) && !defined(NCPU)
23# define NCPU			2
24#endif /* SMP && NCPU */
25
26#if defined(SMP) || defined(APIC_IO)
27
28#include <machine/apic.h>
29
30/* global data in mpboot.s */
31extern int			bootMP_size;
32
33/* functions in mpboot.s */
34void	bootMP			__P((void));
35
36/* global data in mplock.s */
37extern u_int			mp_lock;
38
39/* functions in mplock.s */
40void	get_mplock		__P((void));
41void	rel_mplock		__P((void));
42void	try_mplock		__P((void));
43
44/* global data in mp_machdep.c */
45extern int			mp_ncpus;
46extern int			mp_naps;
47extern int			mp_nbusses;
48extern int			mp_napics;
49extern int			mp_picmode;
50extern int			mpenabled;
51extern int			boot_cpu_id;
52extern vm_offset_t		cpu_apic_address;
53extern vm_offset_t		io_apic_address[];
54extern u_int32_t		cpu_apic_versions[];
55extern u_int32_t		io_apic_versions[];
56extern int			cpu_num_to_apic_id[];
57extern int			io_num_to_apic_id[];
58extern int			apic_id_to_logical[];
59extern u_int			SMP_prvpt[];
60extern u_char			SMP_ioapic[];
61
62/* functions in mp_machdep.c */
63u_int	mp_bootaddress		__P((u_int));
64int	mp_probe		__P((void));
65void	mp_start		__P((void));
66void	mp_announce		__P((void));
67u_int	isa_apic_mask		__P((u_int));
68int	isa_apic_pin		__P((int));
69int	pci_apic_pin		__P((int, int, int));
70int	undirect_isa_irq	__P((int));
71int	undirect_pci_irq	__P((int));
72int	apic_bus_type		__P((int));
73int	apic_src_bus_id		__P((int, int));
74int	apic_src_bus_irq	__P((int, int));
75int	apic_int_type		__P((int, int));
76int	apic_trigger		__P((int, int));
77int	apic_polarity		__P((int, int));
78void	configure_local_apic	__P((void));
79void	init_secondary		__P((void));
80void	smp_invltlb		__P((void));
81
82/* global data in mpapic.c */
83extern volatile lapic_t		lapic;
84
85#if defined(MULTIPLE_IOAPICS)
86#error MULTIPLE_IOAPICSXXX
87#else
88extern volatile ioapic_t	*ioapic[];
89#endif /* MULTIPLE_IOAPICS */
90
91/* functions in mpapic.c */
92void	apic_initialize		__P((int));
93int	apic_ipi		__P((int, int, int));
94int	selected_apic_ipi	__P((u_int, int, int));
95int	io_apic_setup		__P((int));
96int	ext_int_setup		__P((int, int));
97void	write_io_apic_mask24	__P((int, u_int32_t));
98
99#if defined(READY)
100void	clr_io_apic_mask24	__P((int, u_int32_t));
101void	set_io_apic_mask24	__P((int, u_int32_t));
102#endif /* READY */
103
104void	set_apic_timer		__P((int));
105int	read_apic_timer		__P((void));
106void	u_sleep			__P((int));
107
108/* global data in init_smp.c */
109extern int			smp_active;
110extern int			invltlb_ok;
111
112extern volatile u_int		cpuid;
113extern volatile u_int		cpu_lockid;
114
115#endif /* SMP || APIC_IO */
116#endif /* KERNEL */
117#endif /* _MACHINE_SMP_H_ */
118